Safe automated network changes: dry runs, canaries, batches and rollback
In short: Automation can change hundreds of devices in minutes, which means a mistake also spreads in minutes. Safe automation uses idempotent tasks, dry runs that show the exact diff, canary devices first, gradually increasing batches, automatic checks that stop the rollout on errors, ready rollback methods such as commit confirmed, and logs of every change.
Limiting the blast radius
A manual typo affects one device. An automated typo can affect every device in the inventory. Good automation is designed so that mistakes are noticed early and affect as few devices as possible.
Idempotency
An idempotent task makes a change only if needed, and running it twice gives the same result. Ansible network modules and configuration-replace approaches are designed this way. Scripts that blindly send commands may add duplicate lines or fail on the second run.
Dry runs and diffs
- Ansible:
ansible-playbook site.yml --check --diffshows what would change without changing it. - NAPALM: load a candidate configuration, call
compare_config()to see the diff, then commit or discard. - Review the diff for a sample of devices before running for real.
Canaries and batches
- Apply first to one or two low-risk devices (canaries), and verify.
- Then roll out in batches, for example 5, then 20, then the rest. In Ansible, the
serialkeyword controls batch size, andmax_fail_percentagestops the play if too many hosts fail.
Automatic verification and stop conditions
After each batch, run checks: devices reachable, routing neighbours up, interfaces as expected, key services working. If checks fail, stop the rollout and alert the operator rather than continuing.
Rollback
- Commit confirmed (Junos, IOS XR and others): the change reverts automatically unless confirmed within a few minutes, which protects against losing management access.
- Configuration archive and replace on Cisco IOS XE:
configure replacewith a saved configuration restores the previous state. - Store the pre-change configuration of every device before starting.
Protect management access
Be extra careful with changes to management ACLs, AAA, routing to management networks and interfaces used for SSH. Use commit confirmed, test on canaries, and have out-of-band access ready.
Logging
Record who ran what, against which devices, with which inputs, and the results. This supports troubleshooting and audit.
Real-world example: the ACL that locked everyone out
A script pushed a new management ACL to 400 switches at once. The ACL had the wrong subnet for the jump servers, and every switch became unreachable over SSH, requiring console visits. The team rebuilt its process: dry run with diff, two canary switches, batches of 20 with reachability checks between them, and an automatic revert timer on platforms that support it.
Practice
What does idempotent mean in automation?
How does commit confirmed protect against mistakes?
What Ansible keyword controls the batch size of a rollout?
Key takeaways
- Automation spreads mistakes quickly; limit the blast radius.
- Use idempotent tasks, dry runs and diffs before real changes.
- Start with canaries, roll out in batches and stop on failed checks.
- Prepare rollback, protect management access and log every change.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.