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 multiple changes being pushed to NetBox by different engineers and then having multiple changes being made to the network devices with very little change control.

Now that Ansible is able to make changes to my NetBox test, I can use Git to create a new branch and have that config staged and approved before it gets pushed to NetBox.

GitLab Merge Request

I am using GitLab as the code repo, to set this up please see this post.
The new tenant I have added to the vars file, is now pending the creation of a Merge Request in GitLab

The Merge Request is now ready to be merged. This is the stage where changes can be pending, only merging when the change is ready to be executed.
Once merged, the engineer can use the Ansible playbook to push the changes to NetBox and then out to the network devices, removing conflicting changes all being pushed to NetBox as a staging environment.

Rollback

The rollback for Ansible isn’t as clean as it would be in Terraform. I have previously talked about the state parameter being set to present or absent. Any rollback will need to have this parameter changed and Ansible rerun to quickly rollback NetBox changes.

Leave a Comment

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