cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1161
Views
0
Helpful
2
Replies

Converting Configuration on IOS XE, XR & NXOS to Yaml for Ansible

Rotha_Chea
Level 1
Level 1

Dear Community,

I am new to Ansible and I am looking for practical solutions to convert/parse existing thousands lines of Cisco configuration on IOS XE, XR & NXOS to a Yaml format for working on the automation with Ansible.

Thanks for your kind sharing and guideline.

Regards,

Rotha

2 Replies 2

Gioacchino
Level 1
Level 1

Don't feel alone on the Mother Earth.
Maybe the tool, available in the link BELOW, suites your needs?

https://github.com/OliElli/conf2yaml

t-roy
Level 1
Level 1

I am going to dance around your question before I attempt to answer it.

When we started our automation journey we didn't simply start managing thousands of devices as single units, but stepped back and built a foundation we could automate around.  Something like:

What do we have?  Without a Source-of-Truth for our inventory we didn't know what was automatable, so we settled on a platform for that.

Next we build Roles for devices, so that the devices in inventory could properly be categorized.

Finally, we built config templates for devices in a given role.

Ok, so now I am building a YAML file for a role, let's say Core Router.  Depending on WHAT you are configuring, if you're using the ios_config module, you may have several 'parents' lines of config.  To get started though, parsing config files with python and ciscoconfparse was helpful for me.