-
Notifications
You must be signed in to change notification settings - Fork 1
/
ps_create_volume.yml
53 lines (51 loc) · 1.68 KB
/
ps_create_volume.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
---
# Example playbook to create a volume on a FlashArray
#
# Provide the following parameters to the ansible-playbook command
# using the -e switch:
#
# -e "volname=volume-name size=capacity"
#
# For example:
#
# ansible-playbook flasharray_create_volume.yaml -e "volname=test-vol size=10G"
#
# Note: volume name must conform to the naming convention rules required by the FlashArray and
# the volume size must be entered as a number (bytes) or as a string with a single character
# unit symbol. Valid unit symbols are K, M, G, T, P, representing KiB, MiB, GiB, TiB, and
# PiB, respectively, where "Ki" denotes 2^10, "Mi" denotes 2^20, and so on. If the unit
# symbol is not specified, the unit defaults to bytes.
#
- name: Create volume 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: create volume
uri:
url: https://{{ arrayurl }}/api/{{ api_version }}/volume/{{ volname }}
method: POST
validate_certs: no
HEADER_Cookie: "{{session.set_cookie}}"
return_content: yes
body:
size: "{{ size }}"
body_format: json
ignore_errors: yes
- 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