# Cisco Backup

> Generate Python scripts for Cisco device backup, inventory collection, and configuration management. Use when the user wants to back up configs, collect inventory, diff configurations, or track config changes.

- Skill: `bradmccloskey/cisco-backup` (Agent Skill)
- Install (CLI): `npx skillmds@latest add bradmccloskey/cisco-backup`
- Raw SKILL.md: https://api.skillmd.com/api/skills/bradmccloskey/cisco-backup/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: bradmccloskey (https://skillmd.com/u/bradmccloskey)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/bradmccloskey/cisco-backup

---


## Cisco Backup & Inventory Scripts

Write Python scripts for device backup and inventory management. Follow these standards:

### Capabilities

#### Configuration Backup
- Pull running-config and startup-config via SSH
- Save configs with timestamped filenames
- Organize by device hostname and date
- Support incremental backups (skip if unchanged)
- Diff current vs previous backup and alert on changes

#### Inventory Collection
- Collect `show version`, `show inventory`, `show module`
- Parse hardware model, serial numbers, software version, uptime
- Build CSV/JSON inventory reports
- Track software versions across the network for compliance

#### Config Diff & Compliance
- Diff running vs startup config
- Diff running config vs golden template
- Flag non-compliant settings (e.g., missing NTP, wrong SNMP community)
- Generate remediation commands

### Libraries to Use
- `netmiko` for SSH connections
- `napalm` for `get_config()` and `get_facts()`
- `difflib` for config comparison
- `concurrent.futures` for parallel device connections
- `csv` / `openpyxl` for inventory reports
- `os` / `pathlib` for file management
- `datetime` for timestamps

### Directory Structure for Backups
```
backups/
  ├── 2024-01-15/
  │   ├── R1_running.cfg
  │   ├── R1_startup.cfg
  │   ├── SW1_running.cfg
  │   └── ...
  └── 2024-01-16/
      └── ...
```

### Device Inventory Format (YAML input)
```yaml
devices:
  - hostname: R1
    host: 192.168.1.1
    device_type: cisco_ios
    username: admin
    # password from env var or vault
  - hostname: SW1
    host: 192.168.1.2
    device_type: cisco_ios
```

### Security Requirements
- NEVER hardcode passwords in scripts
- Use environment variables, `.env` files (gitignored), or vault integration
- Support SSH key authentication
- Mask credentials in log output

