-
Notifications
You must be signed in to change notification settings - Fork 1
/
ps_list_volumes_host.yml
43 lines (39 loc) · 1.18 KB
/
ps_list_volumes_host.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
---
# Example playbook to check whether a volume is mapped to a host on a FlashArray
#
# execute as
# ansible-playbook playbook/ps_list_host_volume.yml -e "volumename=myvolume_data_02"
#
- name: List host volumes on FlashArray
hosts: localhost
gather_facts: no
tasks:
- name: open session
uri:
url: https://{{ arrayurl }}/api/{{ api_version }}/auth/session
method: POST
validate_certs: no
return_content: yes
body:
api_token: "{{ array_token }}"
body_format: json
register: session
- name: list volumes of a host
uri:
url: https://{{ arrayurl }}/api/{{ api_version }}/volume/{{ volumename }}/host
method: GET
validate_certs: no
HEADER_Cookie: "{{session.set_cookie}}"
return_content: yes
ignore_errors: yes
register: hostdata
- name: show host list
debug: msg="{{ hostdata.json }}"
- name: close session
uri:
url: https://{{ arrayurl }}/api/{{ api_version }}/auth/session
method: DELETE
validate_certs: no
return_content: yes
HEADER_Cookie: "{{session.set_cookie}}"
register: session_close