Debian Codegraph @

ansible_collections/dellemc/unity/playbooks/modules/nfs.yml

raw symbols SCIP
1 ---
2 - name: NFS Share Module Operations on Unity
3 hosts: localhost
4 connection: local
5 vars:
6 unispherehost: '10.*.*.*'
7 validate_certs: false
8 username: 'user'
9 password: '**'
10 nfs_export_name_from_fs: 'ansible_nfs'
11 nfs_export_name_from_snap: 'ansible_snap_nfs'
12 filesystem_id: 'fs_377'
13 filesystem_name: 'ansible_fs'
14 nas_server_id: 'nas_3'
15 nas_server_name: 'lglad071'
16 snapshot_id: '171798692329'
17 snapshot_name: 'ansible_fs_snap'
18 description: 'Ansible Unity Module'
19 anonymous_gid: 4294967290
20 anonymous_uid: 4294967290
21 host_id1: 'Host_12'
22 host_id2: 'Host_14'
23 host_id3: 'Host_31'
24 host_id4: 'Host_63'
25 host_name1: 'testlgl3'
26 host_name2: 'testlgl2'
27 host_name3: 'testlgl1'
28 host_name4: 'test.lss.com'
29 ip_address1: '10.*.*.*/24'
30 ip_address2: 'fdfe:9042:c53d:0:250:56ff:fea2:5143'
31
32 tasks:
33 - name: Create nfs share from filesystem
34 nfs:
35 unispherehost: "{{ unispherehost }}"
36 username: "{{ username }}"
37 password: "{{ password }}"
38 validate_certs: "{{ validate_certs }}"
39 nfs_export_name: "{{ nfs_export_name_from_fs }}"
40 path: '/'
41 filesystem_id: "{{ filesystem_id }}"
42 description: "{{ description }}"
43 min_security: "SYS"
44 default_access: "READ_ONLY"
45 state: "present"
46 register: result
47
48 - name: Set nfs share ID created from filesystem
49 ansible.builtin.set_fact:
50 nfs_export_id_from_fs: "{{ result['nfs_share_details']['id'] }}"
51
52 - name: Create nfs share from filesystem - idempotency
53 nfs:
54 unispherehost: "{{ unispherehost }}"
55 username: "{{ username }}"
56 password: "{{ password }}"
57 validate_certs: "{{ validate_certs }}"
58 nfs_export_name: "{{ nfs_export_name_from_fs }}"
59 path: '/'
60 filesystem_name: "{{ filesystem_name }}"
61 nas_server_id: "{{ nas_server_id }}"
62 state: "present"
63 register: result
64
65 - name: Modify nfs share(fs)
66 nfs:
67 unispherehost: "{{ unispherehost }}"
68 username: "{{ username }}"
69 password: "{{ password }}"
70 validate_certs: "{{ validate_certs }}"
71 nfs_export_name: "{{ nfs_export_name_from_fs }}"
72 filesystem_name: "{{ filesystem_name }}"
73 nas_server_id: "{{ nas_server_id }}"
74 description: ""
75 default_access: "READ_ONLY_ROOT"
76 anonymous_gid: "{{ anonymous_gid }}"
77 anonymous_uid: "{{ anonymous_uid }}"
78 state: "present"
79 register: result
80
81 - name: Modify nfs share(fs) - idempotency
82 nfs:
83 unispherehost: "{{ unispherehost }}"
84 username: "{{ username }}"
85 password: "{{ password }}"
86 validate_certs: "{{ validate_certs }}"
87 nfs_export_name: "{{ nfs_export_name_from_fs }}"
88 filesystem_name: "{{ filesystem_name }}"
89 nas_server_id: "{{ nas_server_id }}"
90 description: ""
91 default_access: "READ_ONLY_ROOT"
92 anonymous_gid: "{{ anonymous_gid }}"
93 anonymous_uid: "{{ anonymous_uid }}"
94 state: "present"
95 register: result
96
97 - name: Create nfs share from snapshot
98 nfs:
99 unispherehost: "{{ unispherehost }}"
100 username: "{{ username }}"
101 password: "{{ password }}"
102 validate_certs: "{{ validate_certs }}"
103 nfs_export_name: "{{ nfs_export_name_from_snap }}"
104 path: '/'
105 snapshot_name: "{{ snapshot_name }}"
106 description: "{{ description }}"
107 min_security: "SYS"
108 default_access: "READ_ONLY"
109 state: "present"
110 register: result
111
112 - name: Set nfs share ID created from snapshot
113 ansible.builtin.set_fact:
114 nfs_export_id_from_snap: "{{ result['nfs_share_details']['id'] }}"
115
116 - name: Create nfs share from snapshot - idempotency
117 nfs:
118 unispherehost: "{{ unispherehost }}"
119 username: "{{ username }}"
120 password: "{{ password }}"
121 validate_certs: "{{ validate_certs }}"
122 nfs_export_name: "{{ nfs_export_name_from_snap }}"
123 path: '/'
124 snapshot_id: "{{ snapshot_id }}"
125 state: "present"
126 register: result
127
128 - name: Modify nfs share(snapshot)
129 nfs:
130 unispherehost: "{{ unispherehost }}"
131 username: "{{ username }}"
132 password: "{{ password }}"
133 validate_certs: "{{ validate_certs }}"
134 nfs_export_name: "{{ nfs_export_name_from_snap }}"
135 snapshot_id: "{{ snapshot_id }}"
136 description: ''
137 default_access: "READ_ONLY_ROOT"
138 anonymous_gid: "{{ anonymous_gid }}"
139 anonymous_uid: "{{ anonymous_uid }}"
140 state: "present"
141 register: result
142
143 - name: Modify nfs share(snapshot) - idempotency
144 nfs:
145 unispherehost: "{{ unispherehost }}"
146 username: "{{ username }}"
147 password: "{{ password }}"
148 validate_certs: "{{ validate_certs }}"
149 nfs_export_name: "{{ nfs_export_name_from_snap }}"
150 snapshot_id: "{{ snapshot_id }}"
151 description: ''
152 default_access: "READ_ONLY_ROOT"
153 anonymous_gid: "{{ anonymous_gid }}"
154 anonymous_uid: "{{ anonymous_uid }}"
155 state: "present"
156 register: result
157
158 - name: Add host in nfs share(fs)
159 nfs:
160 unispherehost: "{{ unispherehost }}"
161 username: "{{ username }}"
162 password: "{{ password }}"
163 validate_certs: "{{ validate_certs }}"
164 nfs_export_name: "{{ nfs_export_name_from_fs }}"
165 filesystem_id: "{{ filesystem_id }}"
166 adv_host_mgmt_enabled: true
167 no_access_hosts:
168 - host_id: "{{ host_id1 }}"
169 read_only_hosts:
170 - host_id: "{{ host_id2 }}"
171 read_only_root_hosts:
172 - host_name: "{{ host_name1 }}"
173 read_write_hosts:
174 - host_name: "{{ host_name1 }}"
175 read_write_root_hosts:
176 - ip_address: "{{ ip_address1 }}"
177 host_state: "present-in-export"
178 state: "present"
179 register: result
180
181 - name: Add host in nfs share(fs) - idempotency
182 nfs:
183 unispherehost: "{{ unispherehost }}"
184 username: "{{ username }}"
185 password: "{{ password }}"
186 validate_certs: "{{ validate_certs }}"
187 nfs_export_name: "{{ nfs_export_name_from_fs }}"
188 filesystem_id: "{{ filesystem_id }}"
189 adv_host_mgmt_enabled: true
190 no_access_hosts:
191 - host_id: "{{ host_id1 }}"
192 read_only_hosts:
193 - host_id: "{{ host_id2 }}"
194 read_only_root_hosts:
195 - host_name: "{{ host_name1 }}"
196 read_write_hosts:
197 - host_name: "{{ host_name1 }}"
198 read_write_root_hosts:
199 - ip_address: "{{ ip_address1 }}"
200 host_state: "present-in-export"
201 state: "present"
202 register: result
203
204 - name: Add more host in nfs share(fs)
205 nfs:
206 unispherehost: "{{ unispherehost }}"
207 username: "{{ username }}"
208 password: "{{ password }}"
209 validate_certs: "{{ validate_certs }}"
210 nfs_export_name: "{{ nfs_export_name_from_fs }}"
211 filesystem_id: "{{ filesystem_id }}"
212 adv_host_mgmt_enabled: true
213 no_access_hosts:
214 - host_id: "{{ host_id1 }}"
215 - host_name: "{{ host_name1 }}"
216 read_only_hosts:
217 - host_id: "{{ host_id2 }}"
218 - host_id: "{{ host_id3 }}"
219 read_only_root_hosts:
220 - host_name: "{{ host_name2 }}"
221 - host_name: "{{ host_name3 }}"
222 read_write_hosts:
223 - host_name: "{{ host_name4 }}"
224 - host_id: "{{ host_id4 }}"
225 read_write_root_hosts:
226 - ip_address: "{{ ip_address1 }}"
227 - ip_address: "{{ ip_address2 }}"
228 host_state: "present-in-export"
229 state: "present"
230 register: result
231
232 - name: Remove host in nfs share(fs)
233 nfs:
234 unispherehost: "{{ unispherehost }}"
235 username: "{{ username }}"
236 password: "{{ password }}"
237 validate_certs: "{{ validate_certs }}"
238 nfs_export_name: "{{ nfs_export_name_from_fs }}"
239 filesystem_id: "{{ filesystem_id }}"
240 adv_host_mgmt_enabled: true
241 no_access_hosts:
242 - host_id: "{{ host_id1 }}"
243 - host_name: "{{ host_name1 }}"
244 read_only_hosts:
245 - host_id: "{{ host_id2 }}"
246 - host_id: "{{ host_id3 }}"
247 read_only_root_hosts:
248 - host_name: "{{ host_name2 }}"
249 - host_name: "{{ host_name3 }}"
250 read_write_hosts:
251 - host_name: "{{ host_name4 }}"
252 - host_id: "{{ host_id4 }}"
253 read_write_root_hosts:
254 - ip_address: "{{ ip_address1 }}"
255 - ip_address: "{{ ip_address2 }}"
256 host_state: "absent-in-export"
257 state: "present"
258 register: result
259
260 - name: Remove host in nfs share(fs) - idempotency
261 nfs:
262 unispherehost: "{{ unispherehost }}"
263 username: "{{ username }}"
264 password: "{{ password }}"
265 validate_certs: "{{ validate_certs }}"
266 nfs_export_name: "{{ nfs_export_name_from_fs }}"
267 filesystem_id: "{{ filesystem_id }}"
268 adv_host_mgmt_enabled: true
269 no_access_hosts:
270 - host_id: "{{ host_id1 }}"
271 - host_name: "{{ host_name1 }}"
272 read_only_hosts:
273 - host_id: "{{ host_id2 }}"
274 - host_id: "{{ host_id3 }}"
275 read_only_root_hosts:
276 - host_name: "{{ host_name2 }}"
277 - host_name: "{{ host_name3 }}"
278 read_write_hosts:
279 - host_name: "{{ host_name4 }}"
280 - host_id: "{{ host_id4 }}"
281 read_write_root_hosts:
282 - ip_address: "{{ ip_address1 }}"
283 - ip_address: "{{ ip_address2 }}"
284 host_state: "absent-in-export"
285 state: "present"
286 register: result
287
288 - name: Add host in nfs share(snapshot)
289 nfs:
290 unispherehost: "{{ unispherehost }}"
291 username: "{{ username }}"
292 password: "{{ password }}"
293 validate_certs: "{{ validate_certs }}"
294 nfs_export_name: "{{ nfs_export_name_from_snap }}"
295 snapshot_name: "{{ snapshot_name }}"
296 adv_host_mgmt_enabled: true
297 no_access_hosts:
298 - host_id: "{{ host_id1 }}"
299 read_only_hosts:
300 - host_id: "{{ host_id2 }}"
301 read_only_root_hosts:
302 - host_name: "{{ host_name1 }}"
303 read_write_hosts:
304 - host_name: "{{ host_name2 }}"
305 read_write_root_hosts:
306 - ip_address: "{{ ip_address1 }}"
307 host_state: "present-in-export"
308 state: "present"
309 register: result
310
311 - name: Add host in nfs share(snapshot) - idempotency
312 nfs:
313 unispherehost: "{{ unispherehost }}"
314 username: "{{ username }}"
315 password: "{{ password }}"
316 validate_certs: "{{ validate_certs }}"
317 nfs_export_name: "{{ nfs_export_name_from_snap }}"
318 snapshot_name: "{{ snapshot_name }}"
319 adv_host_mgmt_enabled: true
320 no_access_hosts:
321 - host_id: "{{ host_id1 }}"
322 read_only_hosts:
323 - host_id: "{{ host_id2 }}"
324 read_only_root_hosts:
325 - host_name: "{{ host_name1 }}"
326 read_write_hosts:
327 - host_name: "{{ host_name2 }}"
328 read_write_root_hosts:
329 - ip_address: "{{ ip_address1 }}"
330 host_state: "present-in-export"
331 state: "present"
332 register: result
333
334 - name: Add more host in nfs share(snapshot)
335 nfs:
336 unispherehost: "{{ unispherehost }}"
337 username: "{{ username }}"
338 password: "{{ password }}"
339 validate_certs: "{{ validate_certs }}"
340 nfs_export_name: "{{ nfs_export_name_from_snap }}"
341 snapshot_name: "{{ snapshot_name }}"
342 adv_host_mgmt_enabled: true
343 no_access_hosts:
344 - host_id: "{{ host_id1 }}"
345 - host_name: "{{ host_name1 }}"
346 read_only_hosts:
347 - host_id: "{{ host_id2 }}"
348 - host_id: "{{ host_id3 }}"
349 read_only_root_hosts:
350 - host_name: "{{ host_name2 }}"
351 - host_name: "{{ host_name3 }}"
352 read_write_hosts:
353 - host_name: "{{ host_name4 }}"
354 - host_id: "{{ host_id4 }}"
355 read_write_root_hosts:
356 - ip_address: "{{ ip_address1 }}"
357 - ip_address: "{{ ip_address2 }}"
358 host_state: "present-in-export"
359 state: "present"
360 register: result
361
362 - name: Remove host in nfs share(snapshot)
363 nfs:
364 unispherehost: "{{ unispherehost }}"
365 username: "{{ username }}"
366 password: "{{ password }}"
367 validate_certs: "{{ validate_certs }}"
368 nfs_export_name: "{{ nfs_export_name_from_snap }}"
369 snapshot_name: "{{ snapshot_name }}"
370 adv_host_mgmt_enabled: true
371 no_access_hosts:
372 - host_id: "{{ host_id1 }}"
373 - host_name: "{{ host_name1 }}"
374 read_only_hosts:
375 - host_id: "{{ host_id2 }}"
376 - host_id: "{{ host_id3 }}"
377 read_only_root_hosts:
378 - host_name: "{{ host_name2 }}"
379 - host_name: "{{ host_name3 }}"
380 read_write_hosts:
381 - host_name: "{{ host_name4 }}"
382 - host_id: "{{ host_id4 }}"
383 read_write_root_hosts:
384 - ip_address: "{{ ip_address1 }}"
385 - ip_address: "{{ ip_address2 }}"
386 host_state: "absent-in-export"
387 state: "present"
388 register: result
389
390 - name: Remove host in nfs share(snapshot) - idempotency
391 nfs:
392 unispherehost: "{{ unispherehost }}"
393 username: "{{ username }}"
394 password: "{{ password }}"
395 validate_certs: "{{ validate_certs }}"
396 nfs_export_name: "{{ nfs_export_name_from_snap }}"
397 snapshot_name: "{{ snapshot_name }}"
398 adv_host_mgmt_enabled: true
399 no_access_hosts:
400 - host_id: "{{ host_id1 }}"
401 - host_name: "{{ host_name1 }}"
402 read_only_hosts:
403 - host_id: "{{ host_id2 }}"
404 - host_id: "{{ host_id3 }}"
405 read_only_root_hosts:
406 - host_name: "{{ host_name2 }}"
407 - host_name: "{{ host_name3 }}"
408 read_write_hosts:
409 - host_name: "{{ host_name4 }}"
410 - host_id: "{{ host_id4 }}"
411 read_write_root_hosts:
412 - ip_address: "{{ ip_address1 }}"
413 - ip_address: "{{ ip_address2 }}"
414 host_state: "absent-in-export"
415 state: "present"
416 register: result
417
418 - name: Get nfs details by nfs ID
419 nfs:
420 unispherehost: "{{ unispherehost }}"
421 username: "{{ username }}"
422 password: "{{ password }}"
423 validate_certs: "{{ validate_certs }}"
424 nfs_export_id: "{{ nfs_export_id_from_fs }}"
425 state: "present"
426 register: result
427
428 - name: Get nfs details by nfs name and filesystem ID
429 nfs:
430 unispherehost: "{{ unispherehost }}"
431 username: "{{ username }}"
432 password: "{{ password }}"
433 validate_certs: "{{ validate_certs }}"
434 nfs_export_name: "{{ nfs_export_name_from_fs }}"
435 filesystem_id: "{{ filesystem_id }}"
436 state: "present"
437 register: result
438
439 - name: Get nfs details by nfs name, filesystem name & nas server ID
440 nfs:
441 unispherehost: "{{ unispherehost }}"
442 username: "{{ username }}"
443 password: "{{ password }}"
444 validate_certs: "{{ validate_certs }}"
445 nfs_export_name: "{{ nfs_export_name_from_fs }}"
446 filesystem_name: "{{ filesystem_name }}"
447 nas_server_id: "{{ nas_server_id }}"
448 state: "present"
449 register: result
450
451 - name: Get nfs details by nfs name, filesystem name & nas server name
452 nfs:
453 unispherehost: "{{ unispherehost }}"
454 username: "{{ username }}"
455 password: "{{ password }}"
456 validate_certs: "{{ validate_certs }}"
457 nfs_export_name: "{{ nfs_export_name_from_fs }}"
458 filesystem_name: "{{ filesystem_name }}"
459 nas_server_name: "{{ nas_server_name }}"
460 state: "present"
461 register: result
462
463 - name: Get nfs details by snapshot name
464 nfs:
465 unispherehost: "{{ unispherehost }}"
466 username: "{{ username }}"
467 password: "{{ password }}"
468 validate_certs: "{{ validate_certs }}"
469 nfs_export_name: "{{ nfs_export_name_from_snap }}"
470 snapshot_name: "{{ snapshot_name }}"
471 state: "present"
472 register: result
473
474 - name: Get nfs details by snapshot ID
475 nfs:
476 unispherehost: "{{ unispherehost }}"
477 username: "{{ username }}"
478 password: "{{ password }}"
479 validate_certs: "{{ validate_certs }}"
480 nfs_export_name: "{{ nfs_export_name_from_snap }}"
481 snapshot_id: "{{ snapshot_id }}"
482 state: "present"
483 register: result
484
485 - name: Delete nfs share by nfs ID
486 nfs:
487 unispherehost: "{{ unispherehost }}"
488 username: "{{ username }}"
489 password: "{{ password }}"
490 validate_certs: "{{ validate_certs }}"
491 nfs_export_id: "{{ nfs_export_id_from_snap }}"
492 state: "absent"
493 register: result
494
495 - name: Delete nfs share by nfs name
496 nfs:
497 unispherehost: "{{ unispherehost }}"
498 username: "{{ username }}"
499 password: "{{ password }}"
500 validate_certs: "{{ validate_certs }}"
501 nfs_export_name: "{{ nfs_export_name_from_fs }}"
502 filesystem_name: "{{ filesystem_name }}"
503 nas_server_name: "{{ nas_server_name }}"
504 state: "absent"
505 register: result
506
507 - name: Add host in nfs share(fs) with adv_host_mgmt_enabled as false
508 nfs:
509 unispherehost: "{{ unispherehost }}"
510 username: "{{ username }}"
511 password: "{{ password }}"
512 validate_certs: "{{ validate_certs }}"
513 nfs_export_name: "csishare-csivol-346b60e518"
514 filesystem_id: "fs_14267"
515 adv_host_mgmt_enabled: false
516 no_access_hosts:
517 - domain: "google.com"
518 read_only_hosts:
519 - netgroup: "netgroup_admin"
520 read_only_root_hosts:
521 - host_name: "host5"
522 read_write_hosts:
523 - subnet: "10.*.*.*/255.255.255.0"
524 read_write_root_hosts:
525 - ip_address: "10.*.*.8"
526 host_state: "present-in-export"
527 state: "present"
528 register: result
529
530 - name: Remove host in nfs share(fs) with adv_host_mgmt_enabled as false
531 nfs:
532 unispherehost: "{{ unispherehost }}"
533 username: "{{ username }}"
534 password: "{{ password }}"
535 validate_certs: "{{ validate_certs }}"
536 nfs_export_name: "csishare-csivol-346b60e518"
537 filesystem_id: "fs_14267"
538 adv_host_mgmt_enabled: false
539 no_access_hosts:
540 - domain: "google.com"
541 read_only_hosts:
542 - netgroup: "netgroup_admin"
543 read_only_root_hosts:
544 - host_name: "host5"
545 read_write_hosts:
546 - subnet: "10.*.*.*/255.255.255.0"
547 read_write_root_hosts:
548 - ip_address: "10.*.*.*"
549 host_state: "absent-in-export"
550 state: "present"
551 register: result