You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To run this as a Docker container, which includes JSNAPy and PyEZ, simply pull it from the Docker hub and run it. The following will pull the latest image and run it in an interactive ash shell.
4
+
5
+
docker run -it --rm juniper/pyez-ansible
6
+
7
+
Although, you'll probably want to bind mount a host directory (perhaps the directory containing your playbooks and associated files). The following will bind mount the current working directory and start the ash shell.
8
+
9
+
docker run -it --rm -v $PWD:/project juniper/pyez-ansible
10
+
11
+
You can also use the container as an executable to run your playbooks. Let's assume we have a typical playbook structure as below:
12
+
13
+
example
14
+
|playbook.yml
15
+
|hosts
16
+
|-vars
17
+
|-templates
18
+
|-scripts
19
+
20
+
We can move to the example directory and run the playbook with the following command:
You can pass any valid command string after the container name and it will be passed to Bash for execution.
26
+
27
+
You may have noticed that the base command is almost always the same. We can also use an alias to save some keystrokes.
28
+
29
+
alias pb-ansible="docker run -it --rm -v $PWD:/project juniper/pyez-ansible ansible-playbook"
30
+
pb-ansible -i hosts playbook.yml
31
+
32
+
### Extending the container with additional packages
33
+
34
+
It's possible to install additional OS (Alpine) packages, Python packages (via pip), and Ansible collections at container instantiation. This can be done by passing in environment variables or binding mount files.
35
+
36
+
#### OS Packages
37
+
38
+
Environment Variable: `$APK`
39
+
Bind Mount: `/extras/apk.txt`
40
+
File Format: list of valid Alpine packages, one per line
41
+
Examples:
42
+
43
+
As an environment variable, where the file containing a list of packages is in the current directory.
44
+
45
+
docker run -it --rm -v $PWD:/project -e APK="apk.txt" juniper/pyez-ansible
46
+
47
+
As a bind mount.
48
+
49
+
docker run -it --rm -v $PWD/apk.txt:/extras/apk.txt juniper/pyez-ansible
To run this as a Docker container, which includes JSNAPy and PyEZ, simply pull it from the Docker hub and run it. The following will pull the latest image and run it in an interactive ash shell.
126
-
127
-
docker run -it --rm juniper/pyez-ansible
128
-
129
-
Although, you'll probably want to bind mount a host directory (perhaps the directory containing your playbooks and associated files). The following will bind mount the current working directory and start the ash shell.
130
-
131
-
docker run -it --rm -v $PWD:/project juniper/pyez-ansible
132
-
133
-
You can also use the container as an executable to run your playbooks. Let's assume we have a typical playbook structure as below:
134
-
135
-
example
136
-
|playbook.yml
137
-
|hosts
138
-
|-vars
139
-
|-templates
140
-
|-scripts
141
-
142
-
We can move to the example directory and run the playbook with the following command:
You can pass any valid command string after the container name and it will be passed to Bash for execution.
148
-
149
-
You may have noticed that the base command is almost always the same. We can also use an alias to save some keystrokes.
150
-
151
-
alias pb-ansible="docker run -it --rm -v $PWD:/project juniper/pyez-ansible ansible-playbook"
152
-
pb-ansible -i hosts playbook.yml
153
-
154
-
### Extending the container with additional packages
155
-
156
-
It's possible to install additional OS (Alpine) packages, Python packages (via pip), and Ansible collections at container instantiation. This can be done by passing in environment variables or binding mount files.
157
-
158
-
#### OS Packages
159
-
160
-
Environment Variable: `$APK`
161
-
Bind Mount: `/extras/apk.txt`
162
-
File Format: list of valid Alpine packages, one per line
163
-
Examples:
164
-
165
-
As an environment variable, where the file containing a list of packages is in the current directory.
166
-
167
-
docker run -it --rm -v $PWD:/project -e APK="apk.txt" juniper/pyez-ansible
168
-
169
-
As a bind mount.
170
-
171
-
docker run -it --rm -v $PWD/apk.txt:/extras/apk.txt juniper/pyez-ansible
0 commit comments