Category: Ansible
Review: Ansible for Networking Engineers
An engineer attending Ansible for Networking Engineers online course sent me this feedback:
This is a great place to learn Ansible and Network Automation from scratch. Starting with an emphasis on the fundamentals (YAML, JSON, Jinja2, how to group your network devices for automation, etc.) you progressively build up towards useful network automation.
He particularly liked the additional features that are part of any ipSpace.net online course:
Avoid Write-Only Code
You probably know that fantastic feeling when you think your newly-discovered tool is a Hammer of Thor, capable of solving every problem (or at least crashing through it). I guess you’re also familiar with that sinking feeling when you’re trying to use your beloved hammer to whitewash a bikeshed.
Not surprisingly, the cruder the tool is, the quicker you’ll hit its limits, like when you try to do data processing in Jinja2 (hint: don’t).
Configuration Templating Could Be a Huge Win
The network automation evangelists love to tell you that automation is more than just device configuration management. They’re absolutely right… but it’s nonetheless amazing how much good you could do with simple tools solving simple problems.
Here’s what I got from Nicky Davey:
How Do You Get Information from Network Devices?
One of the biggest challenges of network automation is getting usable information from network devices… or as asked by a student in my Building Network Automation Solutions online course in the course Slack team:
How do I get specific information from a specific command from a device without an Ansible Network Module? Is Python the only suggested approach?
I described how hard it is to get structured information from network devices in great details in this section of the Ansible for Networking Engineers webinar and online course. Here are a few more thoughts on the topic:
Ansible, Chef, Puppet or Salt? Which One Should I Use?
One of the first things I did when I started my deep-dive into network automation topics was to figure what tools people use to automate stuff and (on a pretty high level) what each one of these tools do.
You often hear about Ansible, Chef and Puppet when talking about network automation tools, with Salt becoming more popular, and CFEngine being occasionally mentioned. However, most network automation engineers prefer Ansible. Here are a few reasons.
Create IP Multicast Tree Graphs from Operational Data
A while ago I created an Ansible playbook that creates network diagrams from LLDP information. Ben Roberts, a student in my Building Network Automation Solutions online course used those ideas to create an awesome solution: he’s graphing multicast trees.
Here’s how he described his solution:
New Content: Debugging Ansible Playbooks and Jinja2 Templates
Here’s a quote from one of my friends who spent years working with Ansible playbooks:
Debugging Ansible is one of the most terrible experiences one can endure…
It’s not THAT bad, particularly if you have a good debugging toolbox. I described mine in the Debugging Ansible Playbooks part of the Ansible for Networking Engineers online course.
Please note that the Building Network Automation Solutions online course includes all material from the Ansible online course.
Automate Remote Site Hardware Refresh Process
Every time we finish the Building Network Automation Solutions online course I ask the attendees to share their success stories with me. Stan Strijakov was quick to reply:
I have yet to complete the rest of the course and assignments, but the whole package was a tremendous help for me to get our Ansible running. We now deploy whole WAN sites within an hour.
Of course I wanted to know more and he sent me a detailed description of what they’re doing:
Automate End-to-End Latency Measurements
Here’s another idea from the Building Network Automation Solutions online course: Ruben Tripiana decided to implement a latency measurement tool. His playbook takes a list of managed devices from Ansible inventory, generates a set of unique device pairs, measures latency between them, and produces a summary report (see also his description of the project).
New Video: Whitespace Handling in Jinja2
Whitespace handling is one of the most confusing aspects of Jinja2, thoroughly frustrating many attendees of my Ansible and Network Automation online courses.
I decided to fix that, ran a few well-controlled experiments, and documented the findings and common caveats in Whitespace Handling in Jinja2 video.
Feedback: Ansible for Networking Engineers
Got this feedback on my Ansible for Networking Engineers webinar:
This webinar is very comprehensive compared to any other Ansible webinars available out there. Ivan does great job of mapping and using real life example which is directly related to daily tasks.
The Ansible online course is even better: it includes support, additional hands-on exercises, sample playbooks, case studies, and lab instructions.
However, Ansible is just a tool that shouldn’t be missing from your toolbox. If you need a bigger picture, consider the Building Network Automation Solutions online course (and register ASAP to save $700 with the Enthusiast ticket).
Lab Requirements for Ansible for Networking Engineers Online Course
One of the undergraduate students attending my Ansible for Networking Engineers online course got to the point where he wanted to start hands-on work and sent me a list of questions:
Do I have to buy a VIRL license to use your Ansible course materials? Or is VIRL in any Github repository? Is there a way to use your files in a free Tool like GNS3?
Let’s go through them one by one:
Create Network Diagram from LLDP Neighbor Information
One of the sample Ansible playbooks I published to help the attendees of my Building Network Automation Solutions course get started collects LLDP neighbor information on all managed devices and converts that information into a network diagram.
Here’s the graph I got from it when I ran it on my 6-node OSPF network (the Inter-AS VIRL topology from this repository). Please note I spent zero time tweaking the graph description (it shows).
… updated on Thursday, February 17, 2022 16:27 UTC
Turn Your Ansible Playbook into a Bash Command
In one of the previous blog posts I described the playbook I use to collect SSH keys from network devices. As I use it quite often, it became tedious to write ansible-playbook path-to-playbook every time I wanted to run the collection process.
Ansible playbooks are YAML documents, and YAML documents use # to start comments, so I thought “what if I’d use a YAML comment to add shebang and turn my YAML document into a script”
TL&DR: It works. Now for the longer story…
Collect SSH Keys with Ansible
Here’s a common scenario I’m encountering on Ansible-related forums:
Q: I cannot connect to network devices with my Ansible network modules. I keep getting these weird error messages…
Me: Are you sure you have the device SSH keys in known_hosts file?
Q: How did you know?