dellemc / dellemc.unity / 2.0.0 / module / nfs Manage NFS export on Unity storage system | "added in version" 1.1.0 of dellemc.unity" Authors: Vivek Soni (@v-soni11) <ansible.team@dell.com>dellemc.unity.nfs (2.0.0) — module
Install with ansible-galaxy collection install dellemc.unity:==2.0.0
collections: - name: dellemc.unity version: 2.0.0
Managing NFS export on Unity storage system includes- Create new NFS export, Modify NFS export attributes, Display NFS export details, Delete NFS export.
- 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"
path: description: - 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. type: str port: default: 443 description: - Port number through which communication happens with Unity management server. type: int state: choices: - absent - present description: - State variable to determine whether NFS export will exist or not. required: true type: str password: description: - The password of the Unity management server. required: true type: str username: description: - The username of the Unity management server. required: true type: str host_state: choices: - present-in-export - absent-in-export description: - Define whether the hosts can access the NFS export. - Required when adding or removing access of hosts from the export. type: str description: description: - Description of the NFS export. - Optional parameter when creating a NFS export. - To modify description, pass the new value in I(description) field. - To remove description, pass the empty value in I(description) field. type: str snapshot_id: description: - ID of the snapshot. - This is a unique ID generated by Unity storage system. type: str min_security: choices: - SYS - KERBEROS - KERBEROS_WITH_INTEGRITY - KERBEROS_WITH_ENCRYPTION description: - NFS enforced security type for users accessing a NFS export. - If not specified at the time of creation, it will be set to C(SYS). type: str anonymous_gid: description: - Specifies the group ID of the anonymous account. - If not specified at the time of creation, it will be set to 4294967294. type: int anonymous_uid: description: - Specifies the user ID of the anonymous account. - If not specified at the time of creation, it will be set to 4294967294. type: int filesystem_id: description: - ID of the filesystem. - This is a unique ID generated by Unity storage system. type: str nas_server_id: description: - ID of the NAS server on which filesystem will be hosted. type: str nfs_export_id: description: - ID of the nfs export. - This is a unique ID generated by Unity storage system. type: str snapshot_name: description: - 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. type: str unispherehost: description: - IP or FQDN of the Unity management server. required: true type: str default_access: choices: - NO_ACCESS - READ_ONLY - READ_WRITE - ROOT - READ_ONLY_ROOT description: - 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 I(default_access) is not mentioned during creation, then NFS export will be created with C(NO_ACCESS). type: str validate_certs: aliases: - verifycert default: true description: - Boolean variable to specify whether or not to validate SSL certificate. - C(true) - Indicates that the SSL certificate should be verified. - C(false) - Indicates that the SSL certificate should not be verified. type: bool filesystem_name: description: - Name of the filesystem for which NFS export will be created. - Either filesystem or snapshot is required for creation of the NFS. - If I(filesystem_name) is specified, then I(nas_server) is required to uniquely identify the filesystem. - If filesystem parameter is provided, then snapshot cannot be specified. type: str nas_server_name: description: - Name of the NAS server on which filesystem will be hosted. type: str nfs_export_name: description: - Name of the nfs export. - Mandatory for create operation. - Specify either I(nfs_export_name) or I(nfs_export_id) (but not both) for any operation. type: str no_access_hosts: description: - Hosts with no access to the NFS export. - List of dictionaries. Each dictionary will have any of the keys from I(host_name), I(host_id), I(subnet), I(netgroup), I(domain) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(true) then the accepted keys are I(host_name), I(host_id) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(false) then the accepted keys are I(host_name), I(subnet), I(netgroup), I(domain) and I(ip_address). elements: dict suboptions: domain: description: - DNS domain, where all NFS clients in the domain are included in the host list. type: str host_id: description: - ID of the host. type: str host_name: description: - Name of the host. type: str ip_address: description: - IP address of the host. type: str netgroup: description: - Netgroup that is defined in NIS or the local netgroup file. type: str subnet: description: - Subnet can be an 'IP address/netmask' or 'IP address/prefix length'. type: str type: list read_only_hosts: description: - Hosts with read-only access to the NFS export. - List of dictionaries. Each dictionary will have any of the keys from I(host_name), I(host_id), I(subnet), I(netgroup), I(domain) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(true) then the accepted keys are I(host_name), I(host_id) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(false) then the accepted keys are I(host_name), I(subnet), I(netgroup), I(domain) and I(ip_address). elements: dict suboptions: domain: description: - DNS domain, where all NFS clients in the domain are included in the host list. type: str host_id: description: - ID of the host. type: str host_name: description: - Name of the host. type: str ip_address: description: - IP address of the host. type: str netgroup: description: - Netgroup that is defined in NIS or the local netgroup file. type: str subnet: description: - Subnet can be an 'IP address/netmask' or 'IP address/prefix length'. type: str type: list read_write_hosts: description: - Hosts with read and write access to the NFS export. - List of dictionaries. Each dictionary will have any of the keys from I(host_name), I(host_id), I(subnet), I(netgroup), I(domain) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(true) then the accepted keys are I(host_name), I(host_id) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(false) then the accepted keys are I(host_name), I(subnet), I(netgroup), I(domain) and I(ip_address). elements: dict suboptions: domain: description: - DNS domain, where all NFS clients in the domain are included in the host list. type: str host_id: description: - ID of the host. type: str host_name: description: - Name of the host. type: str ip_address: description: - IP address of the host. type: str netgroup: description: - Netgroup that is defined in NIS or the local netgroup file. type: str subnet: description: - Subnet can be an 'IP address/netmask' or 'IP address/prefix length'. type: str type: list read_only_root_hosts: description: - Hosts with read-only for root user access to the NFS export. - List of dictionaries. Each dictionary will have any of the keys from I(host_name), I(host_id), I(subnet), I(netgroup), I(domain) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(true) then the accepted keys are I(host_name), I(host_id) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(false) then the accepted keys are I(host_name), I(subnet), I(netgroup), I(domain) and I(ip_address). elements: dict suboptions: domain: description: - DNS domain, where all NFS clients in the domain are included in the host list. type: str host_id: description: - ID of the host. type: str host_name: description: - Name of the host. type: str ip_address: description: - IP address of the host. type: str netgroup: description: - Netgroup that is defined in NIS or the local netgroup file. type: str subnet: description: - Subnet can be an 'IP address/netmask' or 'IP address/prefix length'. type: str type: list adv_host_mgmt_enabled: description: - If C(false), allows you to specify hosts without first having to register them. - Mandatory while adding access hosts. type: bool read_write_root_hosts: description: - 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 I(host_name), I(host_id), I(subnet), I(netgroup), I(domain) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(true) then the accepted keys are I(host_name), I(host_id) and I(ip_address). - If I(adv_host_mgmt_enabled) is C(false) then the accepted keys are I(host_name), I(subnet), I(netgroup), I(domain) and I(ip_address). elements: dict suboptions: domain: description: - DNS domain, where all NFS clients in the domain are included in the host list. type: str host_id: description: - ID of the host. type: str host_name: description: - Name of the host. type: str ip_address: description: - IP address of the host. type: str netgroup: description: - Netgroup that is defined in NIS or the local netgroup file. type: str subnet: description: - Subnet can be an 'IP address/netmask' or 'IP address/prefix length'. type: str type: list
changed: description: Whether or not the resource has changed. returned: always sample: 'false' type: bool nfs_share_details: contains: anonymous_gid: description: Group ID of the anonymous account type: int anonymous_uid: description: User ID of the anonymous account type: int default_access: description: Default access level for all hosts that can access export type: str description: description: Description about the nfs export type: str export_paths: description: Export paths that can be used to mount and access export type: list filesystem: contains: UnityFileSystem: contains: id: description: ID of the filesystem type: str name: description: Name of the filesystem type: str description: filesystem details type: dict description: Details of the filesystem on which nfs export is present type: dict id: description: ID of the nfs export type: str min_security: description: NFS enforced security type for users accessing an export type: str name: description: Name of the nfs export type: str nas_server: contains: UnityNasServer: contains: id: description: ID of the nas server type: str name: description: Name of the nas server type: str description: NAS server details type: dict description: Details of the nas server type: dict no_access_hosts_string: description: Hosts with no access to the nfs export type: str read_only_hosts_string: description: Hosts with read-only access to the nfs export type: str read_only_root_hosts_string: description: Hosts with read-only for root user access to the nfs export type: str read_write_hosts_string: description: Hosts with read and write access to the nfs export type: str read_write_root_hosts_string: description: Hosts with read and write for root user access to export type: str type: description: NFS export type. i.e. filesystem or snapshot type: str description: 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 type: dict