-
Notifications
You must be signed in to change notification settings - Fork 4
/
playbook-isilonSnapShot.yml
66 lines (63 loc) · 1.93 KB
/
playbook-isilonSnapShot.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
-
name: Isilon URI session id
gather_facts: true
#hosts: isilon82DC1
hosts: isilon822dc1
vars:
snapName: API snapshot from ansible
snapPath: /ifs/data
snapExpire: "{{ ansible_date_time.epoch | int + ( 86400 * 3 ) }}"
userName: ansible
userPass: ansible
tasks:
- name: get isilon API session IDs
uri:
url: https://{{ansible_host}}:8080/session/1/session
method: POST
validate_certs: no
body_format: json
body:
{
username: "{{ userName }}",
password: "{{ userPass }}",
services: ["platform", "namespace"]
}
status_code: 201
register: results_login
- debug:
msg="{{ results_login }}"
- name: Create snapshot on isilon
uri:
url: https://{{ansible_host}}:8080/platform/1/snapshot/snapshots
method: POST
return_content: no
validate_certs: no
headers:
Cookie: "isisessid={{ results_login.cookies.isisessid }}"
X-CSRF-Token: "{{ results_login.cookies.isicsrf }}"
referer: "https://{{ansible_host}}:8080"
body_format: json
#body: '{{ lookup("template", "playbook-isilonSNAP.j2") }}'
body:
'{
"name": "{{ snapName }}",
"path": "{{ snapPath }}",
"expires": {{ snapExpire }}
}'
status_code: 201
register: results_cookie
- debug:
msg="{{ results_cookie }}"
- name: Delete isilon API session IDs
uri:
url: https://{{ansible_host}}:8080/session/1/session
method: DELETE
validate_certs: no
headers:
Cookie: "isisessid={{ results_login.cookies.isisessid }}"
X-CSRF-Token: "{{ results_login.cookies.isicsrf }}"
referer: "https://{{ansible_host}}:8080"
status_code: 204
register: results_DEL_cookie
- debug:
msg="{{ results_DEL_cookie }}"