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 it works...

The playbook execution environment inherits all of the variables defined with the host inventory specification so it is able to act upon assertions or other information present therein. When Ansible reads the group specifications, it also looks for a section in the hosts file with the same name as the group suffixed with :vars, in our case JUNOS-devices:vars. It applies the variables observed in this section to all devices within the main JUNOS-devices section.

In the first playbook, we simply had the JUNOS_config task run on the condition that the hardware variable that we defined in the hosts file was an appropriate value. So if we went to the trouble to class each device under management and record it within the inventory ...

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