Main page: 1- Ansible
https://hub.docker.com/r/juniper/pyez-ansible/
Start by clicking on the docker icon ( windows )
Commands:
docker pull juniper/pyez-ansible
...
...
Configuration on the Device | vMX config for ansible + Netconfig
|
...
Local netconfig Test: | |
Remote netconfig test | ssh ansible@192.168.56.11 -p 830 -s netconf |
Install Docker | ||||||||
---|---|---|---|---|---|---|---|---|
Start by clicking on the docker icon ( windows ) | ||||||||
search for available container | docker search juniper | |||||||
pull the image ( optional) |
| |||||||
Check Ansible roles | ||||||||
|
ansible-galaxy list -p roles
| |||||||
Create Ansible files and playbooks | ||||||||
Create an directory ( on the windows host ) + | mkdir facts_playbookscd facts_playbook/ | |||||||
and create the hosts | vi hosts
| |||||||
and create playbook.yml | vi pbk_getfacts.yml |
...
jkriker@jkriker-T460 MINGW64 ~/Documents/ansiblescript
$ cd facts_playbook/
...
vi playbook.yml with OLD module
| ||||||||||||
Start and log back in : RUN & EXEC | ||||||||||||
Start the container: |
-it |
...
/ --volume $PWD is the host directory
| |||||||||||||
log back in the container ( exec <container> ) | docker ps docker exec -it funny_kirch ash /playbooks # cd /project/ | ||||||||||||
basic playbook | |||||||||||||
Basic test with hosts & playbook.yml file: | cd project
| .yml
|
- 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
| ||||||||||
Check connectivity | |||||||||||||
Basic check netconfig | ansible-playbook -i hosts chk_netconf.yml -k -u Netbox
| ||||||||||||
Basic jsnapy | |||||||||||||
check jsnapy | pip3 install -U jsnapy jsnapy --version | ||||||||||||
default jsnapy folder | ls /etc/jsnapy/ -al more /etc/jsnapy/jsnapy.cfg more /etc/jsnapy/logging.yml
| hosts
| [vMX]
192.168.99.11
| ||||||||||
config file | |||||||||||||
test file | |||||||||||||
Basic jsnapy command | |||||||||||||
config file | /project # more /project/jsnapy-demo/configfiles/config1.yml
| ||||||||||||
test file | /project # vi /project/jsnapy-demo/testfiles/show_bgp_summary.yml
| ||||||||||||
run jsnapy | jsnapy --snapcheck pre -f jsnapy-demo/configfiles/config1.yml | ||||||||||||
snapshot output file | sudo apt-get install libxml2-utils xmllint --format ~/jsnapy/snapshots/172.30.95.177_pre_show_bgp_neighbor.xml
| ||||||||||||
snapshot database |