102 lines
1.7 KiB
YAML
102 lines
1.7 KiB
YAML
---
|
|
|
|
- name: BACKUP cisco
|
|
hosts: cisco
|
|
tasks:
|
|
|
|
|
|
- name: GET config cisco
|
|
ios_command:
|
|
commands: sh run
|
|
|
|
register: config
|
|
|
|
|
|
- copy:
|
|
# connection: local
|
|
content: "{{ config.stdout[0] }}"
|
|
dest: "/backup/git/cisco/{{ inventory_hostname }}.txt"
|
|
|
|
# - debug:
|
|
# var: config
|
|
|
|
|
|
|
|
- name: GET config Mikrotik
|
|
hosts: mikrotik
|
|
tasks:
|
|
|
|
|
|
- name: BACKUP Mikrotik
|
|
routeros_command:
|
|
commands: export
|
|
|
|
register: config
|
|
|
|
|
|
- copy:
|
|
content: "{{ config.stdout[0] }}"
|
|
dest: "/backup/git/mikrotik/{{ inventory_hostname }}.txt"
|
|
|
|
- replace:
|
|
path: "/backup/git/mikrotik/{{ inventory_hostname }}.txt"
|
|
regexp: ^# ....\d{1,}..\d{1,}.\d{1,}:\d{1,}:\d{1,}
|
|
replace: "# "
|
|
|
|
- name: backup-file create
|
|
|
|
routeros_command:
|
|
|
|
commands: /system backup save name=bkp
|
|
|
|
- name: backup-file download
|
|
|
|
net_get:
|
|
|
|
src: bkp.backup
|
|
dest: /backup/git/mikrotik/bin/{{inventory_hostname}}.backup
|
|
|
|
protocol: sftp
|
|
|
|
#- debug:
|
|
# var: config
|
|
|
|
|
|
- name: BACKUP huawei
|
|
hosts: huawei
|
|
tasks:
|
|
|
|
|
|
- name: GET config huawei
|
|
ce_command:
|
|
commands: dis cu
|
|
|
|
register: config
|
|
|
|
|
|
- copy:
|
|
# connection: local
|
|
content: "{{ config.stdout[0] }}"
|
|
dest: "/backup/git/huawei/{{ inventory_hostname }}.txt"
|
|
|
|
|
|
|
|
|
|
- name: BACKUP Eltex
|
|
hosts: eltex
|
|
# gather_facts: False
|
|
tasks:
|
|
|
|
|
|
- name: GET config Eltex
|
|
esr_command:
|
|
commands: sh run
|
|
|
|
register: config
|
|
|
|
|
|
- copy:
|
|
# connection: local
|
|
content: "{{ config.stdout[0] }}"
|
|
dest: "./{{ inventory_hostname }}.txt"
|