summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/unity/docs/modules/nfs.rst
blob: cce2058f5b8be6a9cd1dde67f99725e3eaae53f4 (plain)
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
.. _nfs_module:


nfs -- Manage NFS export on Unity storage system
================================================

.. contents::
   :local:
   :depth: 1


Synopsis
--------

Managing NFS export on Unity storage system includes- Create new NFS export, Modify NFS export attributes, Display NFS export details, Delete NFS export.



Requirements
------------
The below requirements are needed on the host that executes this module.

- A Dell Unity Storage device version 5.1 or later.
- Ansible-core 2.12 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.



Parameters
----------

  nfs_export_name (optional, str, None)
    Name of the nfs export.

    Mandatory for create operation.

    Specify either *nfs_export_name* or *nfs_export_id* (but not both) for any operation.


  nfs_export_id (optional, str, None)
    ID of the nfs export.

    This is a unique ID generated by Unity storage system.


  filesystem_name (optional, str, None)
    Name of the filesystem for which NFS export will be created.

    Either filesystem or snapshot is required for creation of the NFS.

    If *filesystem_name* is specified, then *nas_server* is required to uniquely identify the filesystem.

    If filesystem parameter is provided, then snapshot cannot be specified.


  filesystem_id (optional, str, None)
    ID of the filesystem.

    This is a unique ID generated by Unity storage system.


  snapshot_name (optional, str, None)
    Name of the snapshot for which NFS export will be created.

    Either filesystem or snapshot is required for creation of the NFS export.

    If snapshot parameter is provided, then filesystem cannot be specified.


  snapshot_id (optional, str, None)
    ID of the snapshot.

    This is a unique ID generated by Unity storage system.


  nas_server_name (optional, str, None)
    Name of the NAS server on which filesystem will be hosted.


  nas_server_id (optional, str, None)
    ID of the NAS server on which filesystem will be hosted.


  path (optional, str, None)
    Local path to export relative to the NAS server root.

    With NFS, each export of a file_system or file_snap must have a unique local path.

    Mandatory while creating NFS export.


  description (optional, str, None)
    Description of the NFS export.

    Optional parameter when creating a NFS export.

    To modify description, pass the new value in *description* field.

    To remove description, pass the empty value in *description* field.


  host_state (optional, str, None)
    Define whether the hosts can access the NFS export.

    Required when adding or removing access of hosts from the export.


  anonymous_uid (optional, int, None)
    Specifies the user ID of the anonymous account.

    If not specified at the time of creation, it will be set to 4294967294.


  anonymous_gid (optional, int, None)
    Specifies the group ID of the anonymous account.

    If not specified at the time of creation, it will be set to 4294967294.


  state (True, str, None)
    State variable to determine whether NFS export will exist or not.


  default_access (optional, str, None)
    Default access level for all hosts that can access the NFS export.

    For hosts that need different access than the default, they can be configured by adding to the list.

    If *default_access* is not mentioned during creation, then NFS export will be created with ``NO_ACCESS``.


  min_security (optional, str, None)
    NFS enforced security type for users accessing a NFS export.

    If not specified at the time of creation, it will be set to ``SYS``.


  adv_host_mgmt_enabled (optional, bool, None)
    If ``false``, allows you to specify hosts without first having to register them.

    Mandatory while adding access hosts.


  no_access_hosts (optional, list, None)
    Hosts with no access to the NFS export.

    List of dictionaries. Each dictionary will have any of the keys from *host_name*, *host_id*, *subnet*, *netgroup*, *domain* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``true`` then the accepted keys are *host_name*, *host_id* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``false`` then the accepted keys are *host_name*, *subnet*, *netgroup*, *domain* and *ip_address*.


    host_name (optional, str, None)
      Name of the host.


    host_id (optional, str, None)
      ID of the host.


    ip_address (optional, str, None)
      IP address of the host.


    subnet (optional, str, None)
      Subnet can be an 'IP address/netmask' or 'IP address/prefix length'.


    netgroup (optional, str, None)
      Netgroup that is defined in NIS or the local netgroup file.


    domain (optional, str, None)
      DNS domain, where all NFS clients in the domain are included in the host list.



  read_only_hosts (optional, list, None)
    Hosts with read-only access to the NFS export.

    List of dictionaries. Each dictionary will have any of the keys from *host_name*, *host_id*, *subnet*, *netgroup*, *domain* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``true`` then the accepted keys are *host_name*, *host_id* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``false`` then the accepted keys are *host_name*, *subnet*, *netgroup*, *domain* and *ip_address*.


    host_name (optional, str, None)
      Name of the host.


    host_id (optional, str, None)
      ID of the host.


    ip_address (optional, str, None)
      IP address of the host.


    subnet (optional, str, None)
      Subnet can be an 'IP address/netmask' or 'IP address/prefix length'.


    netgroup (optional, str, None)
      Netgroup that is defined in NIS or the local netgroup file.


    domain (optional, str, None)
      DNS domain, where all NFS clients in the domain are included in the host list.



  read_only_root_hosts (optional, list, None)
    Hosts with read-only for root user access to the NFS export.

    List of dictionaries. Each dictionary will have any of the keys from *host_name*, *host_id*, *subnet*, *netgroup*, *domain* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``true`` then the accepted keys are *host_name*, *host_id* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``false`` then the accepted keys are *host_name*, *subnet*, *netgroup*, *domain* and *ip_address*.


    host_name (optional, str, None)
      Name of the host.


    host_id (optional, str, None)
      ID of the host.


    ip_address (optional, str, None)
      IP address of the host.


    subnet (optional, str, None)
      Subnet can be an 'IP address/netmask' or 'IP address/prefix length'.


    netgroup (optional, str, None)
      Netgroup that is defined in NIS or the local netgroup file.


    domain (optional, str, None)
      DNS domain, where all NFS clients in the domain are included in the host list.



  read_write_hosts (optional, list, None)
    Hosts with read and write access to the NFS export.

    List of dictionaries. Each dictionary will have any of the keys from *host_name*, *host_id*, *subnet*, *netgroup*, *domain* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``true`` then the accepted keys are *host_name*, *host_id* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``false`` then the accepted keys are *host_name*, *subnet*, *netgroup*, *domain* and *ip_address*.


    host_name (optional, str, None)
      Name of the host.


    host_id (optional, str, None)
      ID of the host.


    ip_address (optional, str, None)
      IP address of the host.


    subnet (optional, str, None)
      Subnet can be an 'IP address/netmask' or 'IP address/prefix length'.


    netgroup (optional, str, None)
      Netgroup that is defined in NIS or the local netgroup file.


    domain (optional, str, None)
      DNS domain, where all NFS clients in the domain are included in the host list.



  read_write_root_hosts (optional, list, None)
    Hosts with read and write for root user access to the NFS export.

    List of dictionaries. Each dictionary will have any of the keys from *host_name*, *host_id*, *subnet*, *netgroup*, *domain* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``true`` then the accepted keys are *host_name*, *host_id* and *ip_address*.

    If *adv_host_mgmt_enabled* is ``false`` then the accepted keys are *host_name*, *subnet*, *netgroup*, *domain* and *ip_address*.


    host_name (optional, str, None)
      Name of the host.


    host_id (optional, str, None)
      ID of the host.


    ip_address (optional, str, None)
      IP address of the host.


    subnet (optional, str, None)
      Subnet can be an 'IP address/netmask' or 'IP address/prefix length'.


    netgroup (optional, str, None)
      Netgroup that is defined in NIS or the local netgroup file.


    domain (optional, str, None)
      DNS domain, where all NFS clients in the domain are included in the host list.



  unispherehost (True, str, None)
    IP or FQDN of the Unity management server.


  username (True, str, None)
    The username of the Unity management server.


  password (True, str, None)
    The password of the Unity management server.


  validate_certs (optional, bool, True)
    Boolean variable to specify whether or not to validate SSL certificate.

    ``true`` - Indicates that the SSL certificate should be verified.

    ``false`` - Indicates that the SSL certificate should not be verified.


  port (optional, int, 443)
    Port number through which communication happens with Unity management server.





Notes
-----

.. note::
   - The *check_mode* is not supported.
   - The modules present in this collection named as 'dellemc.unity' are built to support the Dell Unity storage platform.




Examples
--------

.. code-block:: yaml+jinja

    
    - name: Create nfs export from filesystem
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_from_fs"
        path: '/'
        filesystem_id: "fs_377"
        state: "present"

    - name: Create nfs export from snapshot
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_from_snap"
        path: '/'
        snapshot_name: "ansible_fs_snap"
        state: "present"

    - name: Modify nfs export
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_from_fs"
        nas_server_id: "nas_3"
        description: ""
        default_access: "READ_ONLY_ROOT"
        anonymous_gid: 4294967290
        anonymous_uid: 4294967290
        state: "present"

    - name: Add host in nfs export with adv_host_mgmt_enabled as true
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_from_fs"
        filesystem_id: "fs_377"
        adv_host_mgmt_enabled: true
        no_access_hosts:
          - host_id: "Host_1"
        read_only_hosts:
          - host_id: "Host_2"
        read_only_root_hosts:
          - host_name: "host_name1"
        read_write_hosts:
          - host_name: "host_name2"
        read_write_root_hosts:
          - ip_address: "1.1.1.1"
        host_state: "present-in-export"
        state: "present"

    - name: Remove host in nfs export with adv_host_mgmt_enabled as true
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_from_fs"
        filesystem_id: "fs_377"
        adv_host_mgmt_enabled: true
        no_access_hosts:
          - host_id: "Host_1"
        read_only_hosts:
          - host_id: "Host_2"
        read_only_root_hosts:
          - host_name: "host_name1"
        read_write_hosts:
          - host_name: "host_name2"
        read_write_root_hosts:
          - ip_address: "1.1.1.1"
        host_state: "absent-in-export"
        state: "present"

    - name: Add host in nfs export with adv_host_mgmt_enabled as false
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_from_fs"
        filesystem_id: "fs_377"
        adv_host_mgmt_enabled: false
        no_access_hosts:
        - domain: "google.com"
        read_only_hosts:
        - netgroup: "netgroup_admin"
        read_only_root_hosts:
        - host_name: "host5"
        read_write_hosts:
        - subnet: "168.159.57.4/255.255.255.0"
        read_write_root_hosts:
        - ip_address: "10.255.2.4"
        host_state: "present-in-export"
        state: "present"

    - name: Remove host in nfs export with adv_host_mgmt_enabled as false
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_from_fs"
        filesystem_id: "fs_377"
        adv_host_mgmt_enabled: false
        no_access_hosts:
        - domain: "google.com"
        read_only_hosts:
        - netgroup: "netgroup_admin"
        read_only_root_hosts:
        - host_name: "host5"
        read_write_hosts:
        - subnet: "168.159.57.4/255.255.255.0"
        read_write_root_hosts:
        - ip_address: "10.255.2.4"
        host_state: "absent-in-export"
        state: "present"

    - name: Get nfs details
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_id: "NFSShare_291"
        state: "present"

    - name: Delete nfs export by nfs name
      dellemc.unity.nfs:
        unispherehost: "{{unispherehost}}"
        username: "{{username}}"
        password: "{{password}}"
        validate_certs: "{{validate_certs}}"
        nfs_export_name: "ansible_nfs_name"
        nas_server_name: "ansible_nas_name"
        state: "absent"



Return Values
-------------

changed (always, bool, false)
  Whether or not the resource has changed.


nfs_share_details (When nfs export exists., dict, {'anonymous_gid': 4294967294, 'anonymous_uid': 4294967294, 'creation_time': '2022-03-09 15:05:34.720000+00:00', 'default_access': 'NFSShareDefaultAccessEnum.NO_ACCESS', 'description': '', 'export_option': 1, 'export_paths': ['**.***.**.**:/dummy-share-123'], 'filesystem': {'UnityFileSystem': {'id': 'fs_id_1', 'name': 'fs_name_1'}}, 'host_accesses': 'None', 'id': 'NFSShare_14393', 'is_read_only': 'None', 'min_security': 'NFSShareSecurityEnum.SYS', 'modification_time': '2022-04-25 08:12:28.179000+00:00', 'name': 'dummy-share-123', 'nfs_owner_username': 'None', 'no_access_hosts': 'None', 'no_access_hosts_string': 'host1,**.***.*.*', 'path': '/', 'read_only_hosts': 'None', 'read_only_hosts_string': '', 'read_only_root_access_hosts': 'None', 'read_only_root_hosts_string': '', 'read_write_hosts': 'None', 'read_write_hosts_string': '', 'read_write_root_hosts_string': '', 'role': 'NFSShareRoleEnum.PRODUCTION', 'root_access_hosts': 'None', 'snap': 'None', 'type': 'NFSTypeEnum.NFS_SHARE', 'existed': True, 'nas_server': {'UnityNasServer': {'id': 'nas_id_1', 'name': 'dummy_nas_server'}}})
  Details of the nfs export.


  anonymous_uid (, int, )
    User ID of the anonymous account


  anonymous_gid (, int, )
    Group ID of the anonymous account


  default_access (, str, )
    Default access level for all hosts that can access export


  description (, str, )
    Description about the nfs export


  id (, str, )
    ID of the nfs export


  min_security (, str, )
    NFS enforced security type for users accessing an export


  name (, str, )
    Name of the nfs export


  no_access_hosts_string (, str, )
    Hosts with no access to the nfs export


  read_only_hosts_string (, str, )
    Hosts with read-only access to the nfs export


  read_only_root_hosts_string (, str, )
    Hosts with read-only for root user access to the nfs export


  read_write_hosts_string (, str, )
    Hosts with read and write access to the nfs export


  read_write_root_hosts_string (, str, )
    Hosts with read and write for root user access to export


  type (, str, )
    NFS export type. i.e. filesystem or snapshot


  export_paths (, list, )
    Export paths that can be used to mount and access export


  filesystem (, dict, )
    Details of the filesystem on which nfs export is present


    UnityFileSystem (, dict, )
      filesystem details


      id (, str, )
        ID of the filesystem


      name (, str, )
        Name of the filesystem




  nas_server (, dict, )
    Details of the nas server


    UnityNasServer (, dict, )
      NAS server details


      id (, str, )
        ID of the nas server


      name (, str, )
        Name of the nas server








Status
------





Authors
~~~~~~~

- Vivek Soni (@v-soni11) <ansible.team@dell.com>