Using Ansible for NetBox

Using Ansible for NetBox

This project came about from the use of NetBox has a source of truth. The source of truth is the desired state of the network. Ansible can then be used to take what is configured in NetBox to configure the network devices.

The problem I have found with this model is that there isn’t any way for multiple user changes made to NetBox not to overlap when the configuration deploy playbooks are run to pull changes from NetBox and push it to the devices. There could be multiples staged changes that different network engineers have prepared that are run by a single engineer running the deployment playbook.

This approach creates all the NetBox configuration as infrastructure as code. Each engineer’s changes may only be pushed to NetBox when they need it. A Git branch can be created for change X and another for change Y. The changes can be executed into NetBox and config deployed to the devices at different times.

There is some more work to do on this. Ansible doesn’t have an easy rollback, as it doesn’t keep a state like Terraform. The problem with my previous testing with Terraform was that the provider isn’t anywhere near as mature as the Ansible Galaxy collection.

Ansible_logo
NetBox and Ansible Setup
This post follows on from the NetBox setup post, upto the API token setup. SSL Configuration with Nginx In...
Ansible_logo
Removing Configuration in NetBox with Ansible
Removing Configuration for Individual Components In the previous post, I demonstrated an example of...
Git-Icon-1788C
Using Git Branches for NetBox Ansible Deployment
Git Branches The purpose of this NetBox Ansible project is to fix the problems I have encountered with...
netbox_icon
Complete Example of Ansible Deployment for NetBox
Example In my previous posts in this project, I have explained how to setup NetBox and a couple of...