Pulls running configurations from multiple Cisco IOS devices over SSH and saves them as timestamped files. Reads device inventory from a YAML file — no hardcoded credentials, no hardcoded hostnames.
What It Does
- Reads device list from
devices.yaml(hostname, IP, credentials, device type) - SSHs into each device using Netmiko
- Runs
show running-configand captures output - Saves each config as
{hostname}_{YYYY-MM-DD_HH-MM}.txt - Logs success/failure per device to
backup.log - Sends an email summary when complete (optional)
Built initially to run nightly via cron across MSP client sites. Catches config drift before it becomes a problem.
Quick Start
1pip install netmiko pyyaml
2git clone https://github.com/windlej/network-config-backup
3cd network-config-backup
4cp devices.example.yaml devices.yaml
5# Edit devices.yaml with your inventory
6python backup.py
devices.yaml Format
1devices:
2 - name: core-sw-01
3 host: 10.0.10.1
4 device_type: cisco_ios
5 username: admin
6 password: "{{ env_var('DEVICE_PASS') }}"
7
8 - name: firewall-01
9 host: 10.0.10.254
10 device_type: cisco_asa
11 username: admin
12 password: "{{ env_var('DEVICE_PASS') }}"
Credentials are read from environment variables — no plaintext passwords in config files.