Introduction
When most of us started in networking, the CLI was king. You typed show ip interface brief, skimmed the columns, and quickly spotted which interfaces were up or down. That works fine for a human staring at one device. But what happens when you need to check hundreds of devices automatically? That’s where things break down.
The problem with CLI for automation
CLI output is built for humans, not machines. It’s full of quirks like: Inconsistent spacing between columns Extra headers and banners Vendor-specific differences Take this Cisco example:
Looks neat to the eye. But if you try to split this text in Python or feed it into Ansible, you’ll quickly run into spacing issues and unreliable parsing.
The solution: structured data
Now it’s easy to:
Run consistency checks
Compare pre-change vs post-change state
Feed data directly into an Ansible inventory or Python script
Demo: parsing with Python
Here’s a minimal parser that converts raw CLI text into JSON. It’s not production-grade, but it shows the concept.
Connecting to Ansible
Now Ansible can load this YAML file directly into a playbook to validate configs, generate reports, or even drive remediation.
Key takeaways
Raw CLI ≠ automation-friendly
Structured data (JSON/YAML) is the foundation for pipelines Even a simple Python script can make CLI data usable today
Later, can replace custom parsing with tools like TextFSM, pyATS, or Batfish
Automation isn’t about abandoning the CLI. It’s about making the data behind the CLI useful at scale.





