-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup-aos8.yml
67 lines (60 loc) · 1.6 KB
/
backup-aos8.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
- name: AOS8 >> check 443 open port
wait_for:
host: '{{ ansible_host }}'
port: 443
state: started
delay: 0
timeout: 1
ignore_errors: true
register: port_443_state
when: device_os == 'aos8'
- name: AOS8 >> enable webserver when needed
ale_aos_config:
host: '{{ ansible_host }}'
username: '{{ ale_username }}'
password: '{{ ale_password }}'
commands:
- webview server enable
- webview access enable
when: device_os == 'aos8' and port_443_state.failed
- name: DEBUG >> port 443 state
debug:
var: port_443_state
verbosity: 2
- name: AOS8 >> rest login, get return cookie
uri:
url: https://{{ ansible_host }}/auth/?username={{ ale_username }}&password={{ ale_password }}
method: GET
validate_certs: false
register: login
until: login.status == 200
when: device_os == 'aos8'
- name: DEBUG >> login
debug:
var: login.cookies_string
verbosity: 2
- name: AOS8 >> backup configuration
uri:
url: https://{{ ansible_host }}/cli/aos/?&cmd=show+configuration+snapshot
method: GET
validate_certs: false
return_content: true
headers:
Cookie: "{{ login['cookies_string'] }}"
Accept: application/vnd.alcatellucentaos+json
register: remote_backup_config
when: device_os == 'aos8'
- name: DEBUG >> remote backup configuration
debug:
var: remote_backup_config
verbosity: 2
- name: AOS8 >> rest logout
uri:
url: https://{{ ansible_host }}/auth/?
method: POST
validate_certs: false
status_code: 200
headers:
Cookies: "{{ login['cookies_string'] }}"
when: device_os == 'aos8'