Ansible and Junos Notes
I’m working on a project to push out configs to Juniper devices and upgrade them if necessary. In the first instance I thought about writing it all in Python, but there’s really no need because quite a lot of legwork has already been done for you in the form of ‘PyEz’ and the Junos Ansible core modules.
Juniper give you a few examples to get you started, but don’t really explain what each of the lines in the YAML file does, but I guess they expect you to figure that out. Below are a few notes on things I discovered – perhaps obvious to some, but they might help someone else.
‘No module named jnpr.junos’ When Running Ansible
In the examples Juniper give, they don’t tell you that the Ansible module ‘Juniper.junos’ relies on a Python module called ‘jnpr.junos’. (It is mentioned elsewhere if you look for it.)
So if you’ve done an ‘ansible-galaxy install Juniper.junos’ you could be forgiven for thinking that you’ve downloaded the modules you need. You then gaily go on to have a crack at the example given above, but get this error:
$ ansible-playbook juniper-test.yml PLAY [Get info] ********************************************************* TASK Continue reading