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.