Update mikrotikbackup.yml
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
- name: Ensure output directory exists
|
- name: Ensure output directory exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: output
|
path: /opt/mikrotik_backups
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
- name: Save export to local file
|
- name: Save export to local file
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: "{{ export_output.stdout }}"
|
content: "{{ export_output.stdout }}"
|
||||||
dest: "output/{{ router_name }}-{{ current_date }}.config"
|
dest: "/opt/mikrotik_backups/{{ router_name }}-{{ current_date }}.config"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: export_output.rc == 0
|
when: export_output.rc == 0
|
||||||
|
|
||||||
@@ -52,11 +52,11 @@
|
|||||||
when: system_identity.rc == 0
|
when: system_identity.rc == 0
|
||||||
|
|
||||||
- name: Download binary backup
|
- name: Download binary backup
|
||||||
shell: timeout 15 scp -o StrictHostKeyChecking=no -P {{ ansible_port }} {{ ansible_user }}@{{ ansible_host }}:{{ router_name }}-{{ current_date }}-backup.backup output/
|
shell: timeout 15 scp -o StrictHostKeyChecking=no -P {{ ansible_port }} {{ ansible_user }}@{{ ansible_host }}:{{ router_name }}-{{ current_date }}-backup.backup /opt/mikrotik_backups/
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: system_identity.rc == 0
|
when: system_identity.rc == 0
|
||||||
|
|
||||||
- name: Remove backup file from router
|
- name: Remove backup file from router
|
||||||
shell: timeout 15 ssh -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }} -p {{ ansible_port }} "/file remove {{ router_name }}-{{ current_date }}-backup.backup"
|
shell: timeout 15 ssh -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }} -p {{ ansible_port }} "/file remove {{ router_name }}-{{ current_date }}-backup.backup"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: system_identity.rc == 0
|
when: system_identity.rc == 0
|
||||||
Reference in New Issue
Block a user