dellemc.unity.nfs module – Manage NFS export on Unity storage system

Note

This module is part of the dellemc.unity collection (version 1.7.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install dellemc.unity. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: dellemc.unity.nfs.

New in dellemc.unity 1.1.0

Synopsis

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

Aliases: dellemc_unity_nfs

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.13 or later.

  • Python 3.9, 3.10 or 3.11.

  • Storops Python SDK 1.2.11.

Parameters

Parameter

Comments

adv_host_mgmt_enabled

boolean

If false, allows you to specify hosts without first having to register them.

Mandatory while adding access hosts.

Choices:

  • false

  • true

anonymous_gid

integer

Specifies the group ID of the anonymous account.

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

anonymous_uid

integer

Specifies the user ID of the anonymous account.

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

default_access

string

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.

Choices:

  • "NO_ACCESS"

  • "READ_ONLY"

  • "READ_WRITE"

  • "ROOT"

  • "READ_ONLY_ROOT"

description

string

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.

filesystem_id

string

ID of the filesystem.

This is a unique ID generated by Unity storage system.

filesystem_name

string

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.

host_state

string

Define whether the hosts can access the NFS export.

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

Choices:

  • "present-in-export"

  • "absent-in-export"

min_security

string

NFS enforced security type for users accessing a NFS export.

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

Choices:

  • "SYS"

  • "KERBEROS"

  • "KERBEROS_WITH_INTEGRITY"

  • "KERBEROS_WITH_ENCRYPTION"

nas_server_id

string

ID of the NAS server on which filesystem will be hosted.

nas_server_name

string

Name of the NAS server on which filesystem will be hosted.

nfs_export_id

string

ID of the nfs export.

This is a unique ID generated by Unity storage system.

nfs_export_name

string

Name of the nfs export.

Mandatory for create operation.

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

no_access_hosts

list / elements=dictionary

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.

domain

string

DNS domain, where all NFS clients in the domain are included in the host list.

host_id

string

ID of the host.

host_name

string

Name of the host.

ip_address

string

IP address of the host.

netgroup

string

Netgroup that is defined in NIS or the local netgroup file.

subnet

string

Subnet can be an ‘IP address/netmask’ or ‘IP address/prefix length’.

password

string / required

The password of the Unity management server.

path

string

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.

port

integer

Port number through which communication happens with Unity management server.

Default: 443

read_only_hosts

list / elements=dictionary

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.

domain

string

DNS domain, where all NFS clients in the domain are included in the host list.

host_id

string

ID of the host.

host_name

string

Name of the host.

ip_address

string

IP address of the host.

netgroup

string

Netgroup that is defined in NIS or the local netgroup file.

subnet

string

Subnet can be an ‘IP address/netmask’ or ‘IP address/prefix length’.

read_only_root_hosts

list / elements=dictionary

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.

domain

string

DNS domain, where all NFS clients in the domain are included in the host list.

host_id

string

ID of the host.

host_name

string

Name of the host.

ip_address

string

IP address of the host.

netgroup

string

Netgroup that is defined in NIS or the local netgroup file.

subnet

string

Subnet can be an ‘IP address/netmask’ or ‘IP address/prefix length’.

read_write_hosts

list / elements=dictionary

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.

domain

string

DNS domain, where all NFS clients in the domain are included in the host list.

host_id

string

ID of the host.

host_name

string

Name of the host.

ip_address

string

IP address of the host.

netgroup

string

Netgroup that is defined in NIS or the local netgroup file.

subnet

string

Subnet can be an ‘IP address/netmask’ or ‘IP address/prefix length’.

read_write_root_hosts

list / elements=dictionary

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.

domain

string

DNS domain, where all NFS clients in the domain are included in the host list.

host_id

string

ID of the host.

host_name

string

Name of the host.

ip_address

string

IP address of the host.

netgroup

string

Netgroup that is defined in NIS or the local netgroup file.

subnet

string

Subnet can be an ‘IP address/netmask’ or ‘IP address/prefix length’.

snapshot_id

string

ID of the snapshot.

This is a unique ID generated by Unity storage system.

snapshot_name

string

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.

state

string / required

State variable to determine whether NFS export will exist or not.

Choices:

  • "absent"

  • "present"

unispherehost

string / required

IP or FQDN of the Unity management server.

username

string / required

The username of the Unity management server.

validate_certs

aliases: verifycert

boolean

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.

Choices:

  • false

  • true ← (default)

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

- 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

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed

boolean

Whether or not the resource has changed.

Returned: always

Sample: false

nfs_share_details

dictionary

Details of the nfs export.

Returned: When nfs export exists.

Sample: {"anonymous_gid": 4294967294, "anonymous_uid": 4294967294, "creation_time": "2022-03-09 15:05:34.720000+00:00", "default_access": "NFSShareDefaultAccessEnum.NO_ACCESS", "description": "", "existed": true, "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", "nas_server": {"UnityNasServer": {"id": "nas_id_1", "name": "dummy_nas_server"}}, "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"}

anonymous_gid

integer

Group ID of the anonymous account

Returned: success

anonymous_uid

integer

User ID of the anonymous account

Returned: success

default_access

string

Default access level for all hosts that can access export

Returned: success

description

string

Description about the nfs export

Returned: success

export_paths

list / elements=string

Export paths that can be used to mount and access export

Returned: success

filesystem

dictionary

Details of the filesystem on which nfs export is present

Returned: success

UnityFileSystem

dictionary

filesystem details

Returned: success

id

string

ID of the filesystem

Returned: success

name

string

Name of the filesystem

Returned: success

id

string

ID of the nfs export

Returned: success

min_security

string

NFS enforced security type for users accessing an export

Returned: success

name

string

Name of the nfs export

Returned: success

nas_server

dictionary

Details of the nas server

Returned: success

UnityNasServer

dictionary

NAS server details

Returned: success

id

string

ID of the nas server

Returned: success

name

string

Name of the nas server

Returned: success

no_access_hosts_string

string

Hosts with no access to the nfs export

Returned: success

read_only_hosts_string

string

Hosts with read-only access to the nfs export

Returned: success

read_only_root_hosts_string

string

Hosts with read-only for root user access to the nfs export

Returned: success

read_write_hosts_string

string

Hosts with read and write access to the nfs export

Returned: success

read_write_root_hosts_string

string

Hosts with read and write for root user access to export

Returned: success

type

string

NFS export type. i.e. filesystem or snapshot

Returned: success

Authors

  • Vivek Soni (@v-soni11)