/
aos-backup-config.yml
35 lines (32 loc) · 1.04 KB
/
aos-backup-config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- name: ARUBA
block:
- name: grab and download aruba config
vars:
ansible_httpapi_port: 4343
ansible_httpapi_validate_certs: False
ansible_httpapi_use_ssl: True
ansible_user: username
ansible_password: pwd
aos_show_command:
command: show running-config
register: aos_output
- name: Save the backup information.
copy:
content: '{{ aos_output.msg._data[0] }}'
dest: "{{ network_backup_dir }}/{{ net_backup_filename }}"
delegate_to: localhost
- name: Add SUCCESS line to file
ansible.builtin.lineinfile:
path: /root/configuration-backup-manager/templates/successful_hosts.txt
line: "{{ inventory_hostname }}"
when: aos_output is defined
delegate_to: localhost
throttle: 1
rescue:
- name: Add ERROR line to file
ansible.builtin.lineinfile:
path: /root/configuration-backup-manager/templates/failed_hosts.txt
line: "{{ inventory_hostname }}"
delegate_to: localhost
throttle: 1