O'Reilly logo

JUNOS Automation Cookbook by Adam Chappell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

We're going to register our devices within the Ansible inventory file and then run a playbook that will capture the configuration files from them.

  1. Update the hosts file for the Ansible installation to include all of the JUNOS devices that you want managed. Remember to specify the connection=local directive in order to use the locally-originated NETCONF-over-SSH channel to the network elements, rather than direct SSH.
   ubuntu@ubuntu-xenial:~/ansible$ cat hosts   [JUNOS-devices]   JUNOS1 ansible_host=10.0.201.201 ansible_user=auto       ansible_ssh_private_key_file=/home/user/auto/JUNOS_auto_id_rsa        ansible_connection=local   JUNOS2 ansible_host=10.0.201.202 ansible_user=auto     ansible_ssh_private_key_file=/home/user/auto/JUNOS_auto_id_rsa ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required