https://hub.docker.com/r/juniper/pyez-ansible/
...
|
|
---|
Start by clicking on the docker icon ( windows ) | |
search for available container | docker search juniper |
pull the image ( optional) | docker pull juniper/pyez-ansible
docker images Creat a local directory
| create the container |
|
### see below, with mounted folder ###
docker run -it --rm -v $PWD:/project juniper/pyez-ansible ash
docker run -it --rm juniper/pyez-ansible ash
Create an directory ( on the windows host ) + |
...
jkriker@jkriker-T460 MINGW64 ~/Documents/ansiblescript
$ cd facts_playbook/
...
| mkdir facts_playbooks cd facts_playbook |
...
Start the container:
cd ~/Documents/ansiblescript/facts_playbook
docker run -it --rm -v $PWD:/project juniper/pyez-ansible ash
-it
--rm
-v $PWD is the host directory
:/project is the container directory
Image Removed
Basic hosts & playbook.yml file:
...
/
|
and create the hosts | vi hosts Code Block |
---|
| [vMX]
192.168.99.11 |
|
and create playbook.yml | vi playbook.yml Code Block |
---|
title | playbook.yml |
---|
collapse | true |
---|
| ---
- name: Get facts
hosts: vMX
connection: local
gather_facts: no
roles:
- Juniper.junos
#vars_prompt:
#- name: ADMUSER
# prompt: Username
# private: no
#- name: ADMPASS
# prompt: password
# private: yes
tasks:
- name: Get junos facts
junos_get_facts:
#host: "{{ inventory_hostname }}"
host: vMX
#user: "{{ ADMUSER }}"
user: "ansible"
#passwd: "{{ ADMPASS }}"
passwd: "ansible123"
register: junos
- name: Print facts
debug:
var: junos |
|
Code Block |
---|
|
[vMX]
192.168.99.11
|
|
|
Start the container: |
cd ~/Documents/ansiblescript/facts_playbook
docker run -it --rm -v $PWD:/project juniper/pyez-ansible ash
-it --rm -v $PWD is the host directory :/project is the container directory juniper/pyez-ansible is the docker image
Image Added ### see below, with mounted folder ###
docker run -it --rm -v $PWD:/project juniper/pyez-ansible ash
docker run -it --rm juniper/pyez-ansible ash
|
Basic test with hosts & playbook.yml file: | ansible-playbook -i hosts playbook.yml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|