Update mikrotikbackup.yml
This commit is contained in:
@@ -13,11 +13,7 @@
|
|||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Get router identity
|
- name: Get router identity
|
||||||
ansible.builtin.shell: >
|
ansible.builtin.shell: ssh -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }} -p {{ ansible_port }} "/system identity print"
|
||||||
ssh -o StrictHostKeyChecking=no
|
|
||||||
{{ ansible_user }}@{{ ansible_host }}
|
|
||||||
-p {{ ansible_port }}
|
|
||||||
"/system identity print"
|
|
||||||
register: system_identity
|
register: system_identity
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
@@ -35,11 +31,7 @@
|
|||||||
current_date: "{{ date_output.stdout }}"
|
current_date: "{{ date_output.stdout }}"
|
||||||
|
|
||||||
- name: Export router config
|
- name: Export router config
|
||||||
ansible.builtin.shell: >
|
ansible.builtin.shell: ssh -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }} -p {{ ansible_port }} "/export"
|
||||||
ssh -o StrictHostKeyChecking=no
|
|
||||||
{{ ansible_user }}@{{ ansible_host }}
|
|
||||||
-p {{ ansible_port }}
|
|
||||||
"/export"
|
|
||||||
register: export_output
|
register: export_output
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
@@ -50,25 +42,13 @@
|
|||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Create binary backup on router
|
- name: Create binary backup on router
|
||||||
ansible.builtin.shell: >
|
ansible.builtin.shell: ssh -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }} -p {{ ansible_port }} "/system backup save name={{ router_name }}-{{ current_date }}-backup"
|
||||||
ssh -o StrictHostKeyChecking=no
|
|
||||||
{{ ansible_user }}@{{ ansible_host }}
|
|
||||||
-p {{ ansible_port }}
|
|
||||||
"/system backup save name={{ router_name }}-{{ current_date }}-backup"
|
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Download binary backup
|
- name: Download binary backup
|
||||||
ansible.builtin.shell: >
|
ansible.builtin.shell: scp -o StrictHostKeyChecking=no -P {{ ansible_port }} {{ ansible_user }}@{{ ansible_host }}:{{ router_name }}-{{ current_date }}-backup.backup output/
|
||||||
scp -o StrictHostKeyChecking=no
|
|
||||||
-P {{ ansible_port }}
|
|
||||||
{{ ansible_user }}@{{ ansible_host }}:{{ router_name }}-{{ current_date }}-backup.backup
|
|
||||||
output/
|
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Remove backup file from router
|
- name: Remove backup file from router
|
||||||
ansible.builtin.shell: >
|
ansible.builtin.shell: ssh -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }} -p {{ ansible_port }} "/file remove {{ router_name }}-{{ current_date }}-backup.backup"
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user