Bulk Config Push Across Devices
Lesson 3 of 10
The Scenario
Your security team says every device needs to point to a new NTP server by end of day. You have 50 devices. Doing it manually — SSH in, paste config, verify, repeat — takes all day. A script does it in 5 minutes.
The Prompt
Write a Python script using Netmiko that:
1. Reads devices from devices.csv (same format as before)
2. Pushes these config commands to each device:
no ntp server 10.1.1.50
ntp server 10.1.1.100
ntp server 10.1.1.101
3. After pushing, runs "show ntp associations" to verify
4. Saves a log of what was pushed and the verification output per device
5. Prints a summary: success/fail count
Include a --dry-run flag that shows what WOULD be pushed without actually pushing.
What AI Gives You
A script with:
send_config_set()to push the commandssend_command()to verify with show output- A
--dry-runargument using argparse - Per-device logging to a file
Review and Validate
- ALWAYS test on one device first — never push to all 50 without verifying the first one
- The dry-run flag is critical — always ask AI to include it
- Check the show output — does NTP actually sync? The script should verify, not just push
Try It Yourself
Pick a simple config change (add a banner, change a description, update SNMP community). Use this pattern to push it to 3 test devices first.
Subscribe to unlock this lesson
₹7,999/year
Full access to all 10 lessons in this course, plus 74 more lab courses, quizzes, and AI mock interviews. 365 days.
Already have an account? Sign in