MakerFLOSS_Mikrotik/roles/makerfloss.mikrotik_switch/tasks/backup.yml

27 lines
908 B
YAML
Raw Normal View History

---
# 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"