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.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
tenant_list: - data: name: Bank1 tenant_group: LPs custom_fields: bankfx_id: "SN123456789" state: present - data: name: Bank2 tenant_group: LPs custom_fields: bankfx_id: "SN987654321" state: present |
0 1 2 3 4 |
git checkout -b Bank2 git commit -am "adding new Bank2 tenant" git push -u origin Bank2 |
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.