Implements Task 8. play_backup.yml ensures the local dir then includes backup.yml, which runs /export + /system backup save and pulls both over SCP (net_get). Binary .backup is gitignored (may contain secrets); export.rsc is committed. Verified against crs310-maker on the bench: both artifacts fetched non-empty. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
908 B
YAML
26 lines
908 B
YAML
---
|
|
# Generate a human-readable /export and a binary /system backup on the device,
|
|
# then pull both into the repo under backups/<host>/. net_get uses SCP over the
|
|
# RouterOS SSH service (same channel play_bootstrap.yml uses for net_put).
|
|
|
|
- name: Generate a config export on the device
|
|
community.routeros.command:
|
|
commands:
|
|
- /export file=export
|
|
changed_when: false
|
|
|
|
- name: Generate a binary system backup on the device
|
|
community.routeros.command:
|
|
commands:
|
|
- /system/backup/save name=backup dont-encrypt=yes
|
|
changed_when: false
|
|
|
|
- name: Fetch the export file into the repo
|
|
ansible.netcommon.net_get:
|
|
src: "export.rsc"
|
|
dest: "{{ playbook_dir }}/backups/{{ inventory_hostname }}/export.rsc"
|
|
|
|
- name: Fetch the binary backup into the repo
|
|
ansible.netcommon.net_get:
|
|
src: "backup.backup"
|
|
dest: "{{ playbook_dir }}/backups/{{ inventory_hostname }}/backup.backup"
|