-
Notifications
You must be signed in to change notification settings - Fork 0
/
ontap_volume_create.yaml
73 lines (73 loc) · 2.89 KB
/
ontap_volume_create.yaml
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
68
69
70
71
72
73
---
#
# var:cluster_admin_ip
# var:ontap_user
# var:lookup_password
# var:vol_name
# var:svm_name
# var:junction_path
# var:vol_size
# var:vol_size_unit
# var:tier_policy
# var:snapdir_access
# var:export_policy
# var:aggregate_name
# var:atime_update
# var:dest_host_name
# var:nfs_srv_ip
# var:dest_mount_point
# var:dest_mount_owner
# var:dest_mount_group
# var:dest_nfs_options
# var:mount_volume
#
- hosts: localhost
name: Volume Create
vars:
hostname: "{{ cluster_admin_ip }}"
username: "{{ ontap_user if ontap_user is defined else 'admin' }}"
password: "{{ ask_password if ask_password is defined else lookup('vars',lookup_password) if lookup_password is defined else ontap_password }}"
volume: "{{ vol_name if vol_name is defined else 'nfsvol' }}"
vserver: "{{ svm_name if svm_name is defined else 'svm0' }}"
volsize: "{{ vol_size if vol_size is defined else '20' }}"
volunit: "{{ vol_size_unit if vol_size_unit is defined else 'gb' }}"
tier: "{{ tier_policy if tier_policy is defined else 'none' }}"
snapdir: "{{ snapdir_access if snapdir_access is defined else 'no' }}"
export: "{{ export_policy if export_policy is defined else 'default' }}"
junction: "{{ junction_path + '/' + volume if junction_path is defined else '/' + volume }}"
aggr: "{{ aggregate_name if aggregate_name is defined else 'aggr1' }}"
atime: "{{ atime_update if atime_update is defined else 'yes' }}"
lif: "{{ nfs_srv_ip if nfs_srv_ip is defined else svm_nfs_lif if svm_nfs_lif is defined else cluster_admin_ip }}"
owner: "{{ dest_mount_owner if dest_mount_owner is defined else 'root' }}"
group: "{{ dest_mount_group if dest_mount_group is defined else 'root' }}"
options: "{{ dest_nfs_options if dest_nfs_options is defined else 'rw,bg,hard,nointr,rsize=65536,wsize=65536,tcp,actimeo=0,vers=4,timeo=600' }}"
mount: "{{ dest_mount_point if dest_mount_point is defined else '/' + volume }}"
runmount: "{{ mount_volume if mount_volume is defined else 'false'|bool }}"
host_name: "{{ dest_host_name if dest_host_name is defined else 'localhost' }}"
tasks:
- name: Create Volume
na_ontap_volume:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
state: present
vserver: "{{ vserver }}"
junction_path: "{{ junction }}"
name: "{{ volume }}"
size: "{{ volsize }}"
size_unit: "{{ volunit }}"
tiering_policy: "{{ tier }}"
snapdir_access: "{{ snapdir }}"
policy: "{{ export }}"
aggregate_name: "{{ aggr }}"
atime_update: "{{ atime }}"
space_guarantee: none
- name: Get NFS LIF
include: ontap_get_svm_lif.yaml
when: nfs_srv_ip is not defined
- name: Mount Volume
include: mount_nfs_tasks.yaml
when: runmount|bool == true
delegate_to: "{{ host_name }}"