From 9e0469e016d96938f9fbbbe8ce46b7d155188f8a Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 6 Jul 2025 11:44:19 +0000 Subject: [PATCH] Create an example config file, remove my own working copy --- .gitignore | 1 + config.yaml | 46 -------------- debian/rules | 2 +- docs/config.yaml.example | 133 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+), 47 deletions(-) delete mode 100644 config.yaml create mode 100644 docs/config.yaml.example diff --git a/.gitignore b/.gitignore index e08ab54..3cdee3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ ipng-router-backup +config.yaml # Debian packaging artifacts debian/.debhelper/ diff --git a/config.yaml b/config.yaml deleted file mode 100644 index 62b5407..0000000 --- a/config.yaml +++ /dev/null @@ -1,46 +0,0 @@ -types: - srlinux: - commands: - - show version - - show platform linecard - - show platform fan-tray - - show platform power-supply - - info flat from running - eos: - commands: - - show version - - show inventory - - show env power - - show running-config - centec: - commands: - - show version | exc uptime - - show boot images - - show transceiver - - show running-config - -devices: - csw150: - user: pim - type: centec - csw151: - user: pim - type: centec - asw100: - user: pim - type: srlinux - asw120: - user: pim - type: srlinux - asw121: - user: pim - type: srlinux - asw110: - user: pim - type: eos - asw111: - user: pim - type: eos - asw112: - user: pim - type: eos diff --git a/debian/rules b/debian/rules index abf34b0..667d56a 100755 --- a/debian/rules +++ b/debian/rules @@ -11,7 +11,7 @@ override_dh_auto_install: mkdir -p debian/ipng-router-backup/etc/ipng-router-backup mkdir -p debian/ipng-router-backup/usr/share/man/man1 cp ipng-router-backup debian/ipng-router-backup/usr/bin/ - cp config.yaml debian/ipng-router-backup/etc/ipng-router-backup/config.yaml.example + cp docs/config.yaml.example debian/ipng-router-backup/etc/ipng-router-backup/config.yaml.example cp docs/router_backup.1 debian/ipng-router-backup/usr/share/man/man1/ipng-router-backup.1 gzip debian/ipng-router-backup/usr/share/man/man1/ipng-router-backup.1 diff --git a/docs/config.yaml.example b/docs/config.yaml.example new file mode 100644 index 0000000..ca44d05 --- /dev/null +++ b/docs/config.yaml.example @@ -0,0 +1,133 @@ +# IPng Networks Router Backup Configuration Example +# Copyright 2025, IPng Networks GmbH, Pim van Pelt +# +# This file demonstrates how to configure the ipng-router-backup tool. +# Copy this file to a location of your choice and modify for your environment. +# +# Usage: ipng-router-backup --config /path/to/your/config.yaml + +# Device Types Section +# Define reusable command sets for different types of network equipment +types: + # Nokia SR Linux devices + srlinux: + commands: + - show version # System version and build info + - show platform linecard # Line card information + - show platform fan-tray # Fan status and health + - show platform power-supply # Power supply status + - info flat from running # Full running configuration + + # Arista EOS devices + eos: + commands: + - show version # System version information + - show inventory # Hardware inventory + - show env power # Power supply status + - show running-config # Complete running configuration + + # Centec switches + centec: + commands: + - show version | exc uptime # Version info without uptime line + - show boot images # Boot image information + - show transceiver # SFP/transceiver status + - show running-config # Running configuration + + # Cisco IOS/IOS-XE devices + cisco-ios: + commands: + - show version # IOS version and hardware info + - show inventory # Hardware inventory details + - show running-config # Complete configuration + - show ip interface brief # Interface IP summary + - show cdp neighbors # CDP neighbor information + + # Juniper devices + junos: + commands: + - show version # Software and hardware version + - show chassis hardware # Chassis hardware details + - show configuration | display set # Configuration in set format + - show interfaces terse # Interface status summary + +# Devices Section +# Define individual network devices to backup +devices: + # Core switches (SR Linux) + asw100: + user: admin # SSH username + type: srlinux # Reference to type above + + asw120: + user: netops # Different user per device if needed + type: srlinux + + asw121: + user: admin + type: srlinux + + # Distribution switches (Centec) + csw150: + user: admin + type: centec + + csw151: + user: admin + type: centec + + # Edge routers (Arista EOS) + edge-01: + user: automation + type: eos + + edge-02: + user: automation + type: eos + + # Special case: Device with custom commands (overrides type) + legacy-router: + user: admin + commands: + - show version + - show running-config + - show ip route summary + # Custom commands specific to this device only + + # Example using IP address instead of hostname + 192.168.1.100: + user: operator + type: cisco-ios + +# Configuration Tips: +# +# 1. Authentication Priority (automatic): +# - SSH Agent (if SSH_AUTH_SOCK environment variable is set) +# - SSH Key file (--key-file flag or default locations) +# - Password (--password flag or interactive prompt) +# +# 2. Running the backup: +# # Backup all devices +# ipng-router-backup --config /etc/ipng-router-backup/config.yaml +# +# # Backup specific devices only +# ipng-router-backup --config config.yaml --host asw100 --host edge-01 +# +# # Custom output directory +# ipng-router-backup --config config.yaml --output-dir /backup/$(date +%Y%m%d) +# +# 3. Output files: +# - Named after device hostname (e.g., 'asw100', 'edge-01') +# - Each command output prefixed with "## COMMAND: " +# - Files are recreated on each run (not appended) +# +# 4. Security considerations: +# - Use SSH keys instead of passwords when possible +# - Consider using SSH agent for additional security +# - Restrict SSH access to backup user accounts +# - Store configuration files with appropriate permissions (640 recommended) +# +# 5. Error handling: +# - If a device is unreachable, the tool continues with other devices +# - Check tool output for connection or authentication failures +# - Use --host flag to test individual devices