Merge pull request #212 from ntwrkguru/master
Updated Dockerfile and README
This commit is contained in:
Коммит
6b18f6b058
|
@ -1,7 +1,7 @@
|
||||||
FROM juniper/pyez:2.0.1
|
FROM juniper/pyez:latest
|
||||||
MAINTAINER ntwrkguru@gmail.com
|
MAINTAINER Stephen Steiner <ssteiner@juniper.net>
|
||||||
|
|
||||||
ARG ver_ansible=2.2.0.0
|
ARG ver_ansible=2.3.0.0
|
||||||
ARG ver_jsnapy=1.0.0
|
ARG ver_jsnapy=1.0.0
|
||||||
|
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
28
README.md
28
README.md
|
@ -85,7 +85,33 @@ This will set your `$ANSIBLE_LIBRARY` variable to the repo location and the inst
|
||||||
[jeremy@ansible-junos-stdlib]$ echo $ANSIBLE_LIBRARY
|
[jeremy@ansible-junos-stdlib]$ echo $ANSIBLE_LIBRARY
|
||||||
/home/jeremy/Ansible/ansible-junos-stdlib/library:/usr/share/ansible
|
/home/jeremy/Ansible/ansible-junos-stdlib/library:/usr/share/ansible
|
||||||
```
|
```
|
||||||
|
### Docker
|
||||||
|
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.
|
||||||
|
```
|
||||||
|
$ docker run -it --rm juniper/pyez-ansible ash
|
||||||
|
```
|
||||||
|
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.
|
||||||
|
```
|
||||||
|
$ docker run -it --rm -v $PWD:/playbooks ash
|
||||||
|
```
|
||||||
|
You can also use the container as an executable to run your playbooks. Let's assume we have a typical playbook structure as below:
|
||||||
|
```
|
||||||
|
example
|
||||||
|
|playbook.yml
|
||||||
|
|hosts
|
||||||
|
|-vars
|
||||||
|
|-templates
|
||||||
|
|-scripts
|
||||||
|
```
|
||||||
|
We can move to the example directory and run the playbook with the following command:
|
||||||
|
```
|
||||||
|
$ docker run -it --rm -v $PWD:/playbooks ansible-playbook -i hosts playbook.yml
|
||||||
|
```
|
||||||
|
You may have noticed that the base command is almost always the same. We can also use an alias to save some keystrokes.
|
||||||
|
```
|
||||||
|
$ alias pb-ansible="docker run -it --rm -v $PWD:/playbooks ansible-playbook"
|
||||||
|
$ pb-ansible -i hosts playbook.yml
|
||||||
|
```
|
||||||
## Example Playbook
|
## Example Playbook
|
||||||
This example outlines how to use Ansible to install or upgrade the software image on a device running Junos OS.
|
This example outlines how to use Ansible to install or upgrade the software image on a device running Junos OS.
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче