-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_svm.yml
185 lines (174 loc) · 5.28 KB
/
create_svm.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
- hosts: localhost
gather_facts: False
name: Create SVM
vars:
hostname: 192.168.1.130
username: admin
password: <PASSWORD>
vserver: AnsibleSVM
tasks:
- name: SVM Create
na_ontap_svm:
state: present
name: "{{ vserver }}"
root_volume: "{{ vserver }}_root"
root_volume_aggregate: aggr1
root_volume_security_style: unix
allowed_protocols: nfs,cifs,iscsi
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
- name: Create DNS
na_ontap_dns:
state: present
vserver: "{{ vserver }}"
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
domains: korphome.local
nameservers: 192.168.1.216
skip_validation: true
https: true
validate_certs: false
- name: Create interface
na_ontap_interface:
state: present
interface_name: "{{ item.interface_name }}"
home_port: "{{ item.home_port }}"
home_node: "{{ item.node }}"
role: data
protocols: "{{ item.protocols }}"
admin_status: up
firewall_policy: mgmt
address: "{{ item.address }}"
netmask: 255.255.255.0
vserver: "{{ vserver }}"
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
loop:
- { node: 'korphome-01', interface_name: '{{ vserver }}_iscsi_1', protocols: 'iscsi', home_port: 'e0a', address: '192.168.1.165' }
- { node: 'korphome-01', interface_name: '{{ vserver }}_iscsi_2', protocols: 'iscsi', home_port: 'e0a', address: '192.168.1.166' }
- { node: 'korphome-01', interface_name: '{{ vserver }}_data_1', protocols: 'nfs,cifs', home_port: 'e0a', address: '192.168.1.167' }
- { node: 'korphome-01', interface_name: '{{ vserver }}_data_2', protocols: 'nfs,cifs', home_port: 'e0a', address: '192.168.1.168' }
- name: Start iscsi service
na_ontap_iscsi:
state: present
service_state: started
vserver: "{{ vserver }}"
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
- name: Create igroup
na_ontap_igroup:
state: present
name: ansibleIgroup
initiator_group_type: iscsi
ostype: vmware
initiator: iqn.1998-01.com.vmware:esxi6-68316bc6,iqn.1991-05.com.microsoft:veeamv10
vserver: "{{ vserver }}"
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
- name: Start nfs service
na_ontap_nfs:
state: present
service_state: started
vserver: "{{ vserver }}"
nfsv3: disabled
nfsv4: disabled
nfsv41: enabled
tcp: disabled
udp: disabled
vstorage_state: disabled
nfsv4_id_domain: example.com
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
- name: Create ans start cifs service
na_ontap_cifs_server:
state: present
cifs_server_name: ontap
workgroup: korphome
service_state: started
vserver: "{{ vserver }}"
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
- name: Volume Create
na_ontap_volume:
state: present
name: "vol_{{ item.1.name }}"
vserver: "{{ vserver }}"
aggregate_name: "{{ item.0.aggr }}"
size: 30
size_unit: gb
policy: default
percent_snapshot_space: 0
efficiency_policy: default
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
loop: "{{ lookup('subelements', aggrs, 'volumes', {'skip_missing': True}) }}"
vars:
aggrs:
- { name: "aggr1", volumes: [11,13,15,17] }
- { name: "aggr1", volumes: [12,14,16,18] }
- name: Create LUN
na_ontap_lun:
state: present
name: "lun_{{ item }}"
flexvol_name: "vol_{{ item }}"
vserver: "{{ vserver }}"
size: 5
size_unit: mb
ostype: vmware
space_reserve: no
space_allocation: yes
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
with_sequence: start=11 end=18
- name: Create LUN mapping
na_ontap_lun_map:
state: present
initiator_group_name: ansibleIgroup
lun_id: "{{ item }}"
path: "/vol/vol_{{ item }}/lun_{{ item }}"
vserver: "{{ vserver }}"
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false
with_sequence: start=11 end=18
- name: Create CIFS share
na_ontap_cifs:
state: present
share_name: Share
path: /
share_properties: browsable,oplocks
symlink_properties: read_only,enable
vserver: "{{ vserver }}"
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
https: true
validate_certs: false