huawei.enterprise.hw_enterprise_nfs_share module – NFS Share operations for Huawei Enterprise Storage

Note

This module is part of the huawei.enterprise collection (version 2.0.0).

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 huawei.enterprise. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: huawei.enterprise.hw_enterprise_nfs_share.

Synopsis

  • Create, delete, modify and get the detail of a Nfs Share

Requirements

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

  • Huawei Dorado v5/v6/v7 and OceanStor v5/v6/v7 Storage

Parameters

Parameter

Comments

custom_vars

dictionary

Parameters used to extend those not currently supported by the module.

Configuration needs to be based on the REST API documentation for storage.

If necessary, you can contact the plugin technical support for assistance.

description

string

NFS Share description.

dtree_id

string

Dtree ID.

filter

list / elements=string

Parameter required for all query operations.

The response will include the storage parameters that match the indicate filter criteria.

Choices:

  • "id"

  • "name"

  • "share_path"

  • "vstore_id"

  • "vstore_name"

  • "fs_id"

  • "dtree_id"

fs_id

string

File system ID.

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

NFS share unique id, Mutually exclusive with “name”, Priority is higher than name.

name

string

NFS share unique name, Mutually exclusive with id.

The value must start with a slash (/). Apart from the starting slash (/),

The value can contain 1 to 255 characters, including letters, digits, special characters

password

string / required

The password of the PowerStore host.

share_path

string

Share path. Required when create NFS Share.

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the NFS share should exist or not.

Choices:

  • "absent"

  • "present"

storage_port

integer

Port number for the Huawei Enterprise array.

If not passed, it will take 8088 as default.

Default: 8088

use_log

boolean

Whether to write plugin log to local filesystem.

Choices:

  • false ← (default)

  • true

username

string / required

The username of the PowerStore host.

valid_certs

string

The path of the SSL certificate variable to specify whether to validate SSL certificate or not.

If don’t set means no need to verify ssl cert.

vstore_id

string

id of storage vstore.

It defaults to 0:SystemVstore if not specified.

Notes

Note

  • The check_mode is not supported.

  • The modules present in this collection named as ‘huawei.enterprise’ are built to support the Huawei Enterprise Storage System.

Examples

tasks:
  - name: Create NFS Share
    register: nfs_share_info
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      share_path: "< nfs_share_path >"
      fs_id: "< fs_id >"
      dtree_id: "< dtree_id >"
      description: "< description >"
      name: "< nfs_share_name >"
      vstore_id: "< vstore_id >"
      state: "present"

  - name: Modify NFS Share By Share Path
    register: nfs_share_info
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      share_path: "< share_path >"
      description: "< description >"
      vstore_id: "< vstore_id >"
      state: "present"

  - name: Modify NFS Share By Id
    register: nfs_share_info
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      id: "{{ nfs_share_info.nfs_share_detail.id }}"
      description: "< description >"
      state: "present"

  - name: Query NFS Share By Share Path
    register: nfs_share_info
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      share_path: "< share_path >"
      filter:
        - id
        - share_path
        - vstore_name
        - vstore_id
        - fs_id
        - dtree_id
        - name
      vstore_id: "< vstore_id >"
      state: "present"

  - name: Query NFS Share By Id
    register: nfs_share_info
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      id: "{{ nfs_share_info.nfs_share_detail.id }}"
      vstore_id: "< vstore_id >"
      filter:
        - id
        - share_path
        - vstore_name
        - vstore_id
        - fs_id
        - dtree_id
        - name
      state: "present"

  - name: Query Multi NFS Share
    register: all_nfs_share
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      vstore_id: "< vstore_id >"
      filter:
        - id
        - share_path
        - vstore_name
        - vstore_id
        - fs_id
        - dtree_id
        - name
      state: "present"

  - name: Delete NFS Share By Share Path
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      share_path: "< share_path >"
      vstore_id: "< vstore_id >"
      state: "absent"

  - name: Delete NFS Share By Id
    huawei.enterprise.hw_enterprise_nfs_share:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      id: "{{ nfs_share_info.nfs_share_detail.id }}"
      vstore_id: "< vstore_id >"
      state: "absent"

Return Values

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

Key

Description

actions

list / elements=string

playbook action lists

Returned: always

Sample: ["create"]

changed

boolean

Whether or not the resource has changed.

Returned: always

Sample: false

nfs_share_detail

complex

Details of the NFS share.

Returned: When Nfs share exists

Sample: {"dtree_id": "5@0", "fs_id": "5", "id": "1", "name": "/sharepath21312", "share_path": "/FileSystem0050001", "speed": "medium", "vstore_id": "0", "vstore_name": "System_vStore"}

dtree_id

string

Dtree ID.

Returned: success

fs_id

string

File system ID.

Returned: success

id

string

The system generated ID given to the Nfs Share.

Returned: success

name

string

Name of the Nfs Share.

Returned: success

share_path

string

Share path.

Returned: success

vstore_id

string

id of storage vstore.

Returned: always

vstore_name

string

Name of storage vstore.

Returned: always

remark

string

task execute remark

Returned: always

Sample: "sample_nfs_share create successfully"

Authors

  • Huawei eSDK Ansible Team