Most teams can get a working Ansible playbook pushing VLANs onto a Cisco switch inside a week. That is the part everyone demos. The part that decides whether the automation survives contact with production is what happens on day 120, when someone console-connects into an access switch at 2 a.m., types switchport trunk allowed vlan add 40, and never files a ticket. Your source of truth is now wrong, the next push either reverts a real fix or silently preserves it, and the tool that looked like a win in the lab becomes the thing that pages you. The question isn't how to automate Cisco switch configuration. It's how to build a loop that stays converged while people keep editing the network by hand.
The push is a week of work; reconciliation is the actual project
Do the arithmetic on your own fleet. Take 240 access and distribution switches, three config changes a week across the fleet, and 25 minutes per change once you count the change window, verification, and the ticket update. That's roughly five engineer-hours a week spent typing — small enough that a naive push-based playbook looks like a complete solution.
Then count the drift. In fleets that size, hand-edits accumulate: a common industry pattern is that 5–10% of devices diverge from intent in any given month, from emergency fixes, contractor console sessions, and half-finished template rollouts. If your automation only writes, you are managing that drift with a quarterly audit and a spreadsheet, which means you find it when something breaks.
Automation that only writes is a deployment tool. Automation that reads, compares, and reconciles is a control loop. Build the second one.
Pick the transport for your fleet, not for the whitepaper
Cisco gives you three ways in, and they are not interchangeable:
- SSH plus CLI — the
ios_configmodule, Netmiko, or NAPALM. Runs on everything from a 2960 to a Nexus, including gear years past end-of-sale. Text-based, slow, and the diffs are noisy. - NETCONF or RESTCONF with YANG models — solid on IOS-XE 16.x and later and NX-OS 9.x and later. Structured output and candidate configs, but model coverage has holes you only discover in production.
- gNMI and model-driven telemetry — excellent for streaming state, still awkward as a config path on most campus hardware.
For a mixed fleet, the pragmatic split is CLI for writes, structured telemetry for reads. You get universal change coverage and honest state data for verification, which is exactly the pair a reconciliation loop needs.
Render from intent, not from per-device config files
If your repository contains 240 near-identical config files, you have not automated anything — you have moved copy-paste into Git. Describe each switch with roughly a dozen intent variables and render the rest.
| Intent variable | Example | Renders into |
|---|---|---|
| site | austin-01 | hostname, syslog, snmp location |
| role | access | interface templates, STP tuning |
| access_vlans | [10, 20, 40] | vlan database, access port blocks |
| uplink_ports | Te1/0/1-2 | trunk config, allowed VLAN list |
| poe_budget | 740 | inline power policy |
A Jinja2 template plus a YAML inventory gets you there in an afternoon. The trap is idempotency: ios_config with parents re-applies your lines on every run unless the rendered block matches exactly, so run check mode first and diff the output before you commit.
Verify with state, not with the config diff
A successful push proves the device accepted your commands. It proves nothing about whether the network works. After every change, assert state on the device itself — six checks, roughly eight seconds per switch:
show interfaces status— an uplink stuck innotconnectshow vlan brief— a VLAN that vanishedshow spanning-tree summary— a root bridge where you didn't expect oneshow lldp neighbors— a neighbor count that droppedshow power inline— a PoE budget you just blewshow ip route summary— a route count that changed shape
Fail the pipeline on any mismatch. And scrub the diff before you compare it: Building configuration..., Current configuration : 4123 bytes, ! Last configuration change at, and ntp clock-period will generate dozens of false positives across a hundred devices if you don't.
The push is the demo; the reconciliation is the product.
Bound the blast radius before you need to
A playbook that touches 240 switches at once is one typo away from an outage you'll read about. Stage it: one canary, then five, then 10% of the fleet, then the rest, and abort automatically if two of the first five fail. In Nornir that's num_workers; in Ansible it's serial: 1 followed by serial: "10%".
Cisco gives you a genuine safety net most teams never enable. On IOS-XE, configure terminal revert timer 10 starts a commit-confirm window: if you don't send configure confirm within ten minutes, the device reloads into its previous config. NX-OS has rollback running-config checkpoint. Older IOS has reload in 10 and reload cancel as the blunt version. Wire these into the change path and a bad template self-heals instead of waking you up.
Rollback is an archive, not a hope
The day you need a rollback is not the day to discover it was never configured. Before the first automated change, enable a config archive on every device: archive, path bootflash:archive, time-period 1440, write-memory. That gives you a dated snapshot on every write and a one-line restore path via configure replace. Make it step zero of your baseline template, so new switches arrive with it already on.
Where this is heading: switches as declarative endpoints
The direction is already visible. Config changes arrive as pull requests, drift shows up as a failed CI check rather than a surprise during an incident, and the console port goes back to being break-glass only. Zero-touch provisioning finishes the job: a replacement switch boots, pulls its identity, and configures itself before anyone drives to the site. The NetOps engineer stops being the transport layer for configuration and starts owning intent — what the network should be, and the loop that keeps it there.

