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 create a new Ansible host inventory with a group to encapsulate all of our JUNOS OS devices. We'll define per-group variables for the JUNOS OS devices in a separate file and we'll encrypt that file by using an Ansible vault.

  1. First of all, create an Ansible hosts file to describe the estate of devices. Include with each host the IP address and the port number of the NETCONF-over-SSH service:
   [JUNOS-devices]   JUNOS1 ansible_host=10.0.201.201 ansible_port=830   JUNOS2 ansible_host=10.0.201.202 ansible_port=830   JUNOS3 ansible_host=10.0.201.203 ansible_port=830
  1. Create a subdirectory in the Ansible inventory directory—the directory that contains the host files—and name it group_vars.
 ubuntu@ubuntu-xenial:~/ansible$ ...

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