Using Ansible to update Junos Device Configurations

Lately I’ve been using Ansible to update configurations on my JunOS devices. Here’s a fun little script to get you started. It will print the configuration of the DHCP service on a JunOS device, then update the name-server DHCP option to something new. The following playbook uses the JunOS ansible role

Install with “ansible-galaxy install Juniper.junos

The structure of your inventory file should be like so —

Here’s the complete playbook. You’ll want to change the “Commit” option to “True” when ready to run. Run with:

Leave a Comment

Your email address will not be published. Required fields are marked *