02-04-2025 01:29 AM - edited 02-04-2025 01:53 AM
Hi!
This is my first ansible journey in the cisco world, been doing this with Juniper before and would appreciate som advice.
My goal is to use Netbox as source of truth and to genereate a complete configuration for each device, not just adding a vlan or generate som vxlan stuff. In the Juniper world we generate a complete config with jinja2 and push to each device with functionality similar to "load overwrite <file>" this loads a complete configuration to the device, can this be done similarly with Cisco equipment? So that we know that config get added and deleted in a correct way.
I have been trying to find a good boiler plate with netbox and ansible but those I have found so far only touches some part of configuration.
Johan
02-04-2025 02:01 AM
For IOS-XE and NX-OS "config replace"
For IOS-XR - "commit replace"
02-04-2025 02:06 AM
Thank you, any ideas for a good starting point for managing a complete config with ansible/netbox?
02-04-2025 02:25 AM
As you already described, generate config based on info from source of truth with jinja templates and then deliver it to device and replace it.
Made it partially for classical campus (interfaces, vlans, so on) and it took more time to populate SoT correctly than made templates/generators.
02-04-2025 02:27 AM
Yes you can do this, with https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_config_module.html in here you would use the replace option. You might find a good example on https://developer.cisco.com/codeexchange/
02-04-2025 02:34 AM
is it safe to do a replace on nxos or will that have impact?
02-04-2025 02:48 AM
It's similar (but not exactly the same) to applying diff of two configuration in CLI. So if you shut any interface or remove VLAN from trunk or remove VPC domain configuration - then yes, it would be impactful, if you change description on interface - then no.
02-04-2025 02:49 AM
@ubf22 done this many time, no problem.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide