The Nerdery Goes After Automation
Even after all of the training I have received, and all the experience I had with route/switch stuff, something that always annoyed me was the tedious stuff that was mindless and prone to errors. I figured I would take advantage of this non-standard duty station to learn some of that fancy dev-opsy stuff to make these tasks take fewer man-hours and be performed more consistently. However, what ended up happening is my partner and I welcomed our first little one, and while I gave Python a cursory look during the little time I have available, there certainly was nothing easy about it. Plus, learning even simple networking tasks in Python during the small pockets of time I was able to patch together was nearly impossible. Enter Ansible. Ansible has coding built-in to make your tasks easier, and while it is not nearly as flexible as Python, it did not take too long to get up and running.
Another amazing tool that keeps getting better is GNS3. I updated my GNS3 prior to starting this project and admittedly, I was fairly frustrated with it at first. I tried to connect a VM (which I configured with Linux and downloaded Ansible on), and struggled to get the VM to connect to GNS3. This used to be super easy to do (this was how I learned most of my CallManager stuff). In the process of my google-engineering, I learned about the network automation docker container that GNS3 provides free of charge. I decided to download this and give it a go, and it turned out to be a really cool new feature. It has Python and Ansible already downloaded, and because it is in docker, it boots even faster than your Cisco routers will, and it really reduces the amount of time you need to be mucking around with your lab environment.
The above screenshot shows you what my environment looks like. It was pretty simple to get this all up and running. Here is what I did to get ready to start playing around with Ansible:
- Configured R1 as a DHCP server to give the Network Automation machine an IP address.
- Configured IPs, routing, and SSH (this is required for Ansible) on all three routers.
- Went into the Network Configuration portion (GNS3 setting) of the Network Automation machine and un-commented the DHCP portion so it would look for an address.
This is what my workspace looked like as I was working through the configuration. A couple of things of note:
- The one big negative of the Network Automation machine (for someone who uses Linux as infrequently as I do) is no GUI and heavy vi usage. It has been a while since I have played around at the Linux command line, so there was a bit of getting back on the horse.
- Editing files at the Linux command line is a huge pain in the butt. Don’t bother. Write everything in a text document and just paste it into the command line. If you make a mistake, just blow it away and start again. Cat to create files that don’t exist, vi to paste in the content from your text document.
I’m planning on a series of posts about some of the stuff that I have learned so far, but as hard as it is to blog these days, I wanted to get this out and let you know some of the stuff I am working on. I’ve finished some really simple Ansible configs where I push the same thing to a bunch of routers at the same time. Next up is some more complicated Ansible using Jinja2, so I can push configs out to a bunch of routers, but with variables for some items. For instance, with simple configs, I can re-name all of the routers the same thing. Using Jinja2, I will be able to name them each something slightly different, but at the same time.
After I am done with learning some more complicated Ansible and playing with Jinja2, I’m either going to learn a bit more Python, or maybe start experimenting with Terraform. Please leave any thoughts you have about which one to start with in the comments.