Using Ansible on legacy Cisco IOS devices

in #ansible7 years ago

I’m studying a bit for one of the Cisco CCNP tests. I have an official Cisco Lab book with a bunch of labs you can set up on your home lab routers/switches and run through to prepare for the test. I’m doing a lab that requires setting up three routers with some configs so I decided to automate the setup. I wrote three Ansible playbooks and then a simple bash script that will run the three scripts at once. I plan on doing this for all the labs in the book. Eventually, I will be able to solve 7-8 labs in a day and not have to spend any time setting them up. I just keep a minimal base config on my routers and as long as I don’t write to memory after I do a lab, I can just power cycle the routers and they will revert back to the minimal base config. I have them all plugged into a rack mounted PDU that has a switch on it, so I can flip the switch and turn on/turn off the whole rack at once.

Here is one of my Ansible playbooks so you can see what it looks like, it’s written in YAML. I have my SSH login credentials stored in a file named secrets.YAML​ and I have a dictionary called provider that references that. I have all three routers in a different group in the hosts file. So the same hosts file can be used by all three playbooks.

https://github.com/colin-mccarthy/Ansible-Playbooks-for-Cisco-IOS/blob/master/CCNP_LAB1

switches.jpg

Sort:  

Congratulations @thenetwork.eng! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!