huawei.enterprise.hw_enterprise_dtree module – Dtree 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_dtree.

Synopsis

  • Supports the provisioning operations on a Dtree such as create, modify, delete and get the details of a Dtree.

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.

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"

  • "vstore_name"

  • "vstore_id"

  • "parent_id"

  • "quota_switch"

  • "quota_switch_status"

  • "security_style"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

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

name

string

Dtree unique name, Required for create operation. Mutually exclusive with id.

new_name

string

Dtree new unique name, Required for modify dtree name.

parent_id

string

ID of the parent file system object, Required for create, query, modify and delete operation.

parent_id and parent_name are mutually exclusive.

parent_name

string

Name of the parent file system object, Required for create, query, modify and delete operation.

parent_id and parent_name are mutually exclusive.

password

string / required

The password of the PowerStore host.

quota_switch

string

Quota switch, Optional parameters for create and modify operation, default false.

Choices:

  • "false"

  • "true"

security_style

string

Security style supported by a dtree directory, Optional parameters for create and modify operation. default unix.

Choices:

  • "native"

  • "ntfs"

  • "unix"

  • "mixed"

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the Dtree 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 parent_id or parent_name param must be set.

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

Examples

---
  tasks:
    - name: Create Dtree
      register: dtree_info
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< dtree_name >"
        parent_id: "< fs_id >"
        parent_name: "< fs_name >"
        quota_switch: "< false | true >"
        security_style: "< native | ntfs | unix | mixed >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Dtree By ID
      register: dtree_info
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "< dtree_id >"
        new_name: "< new_dtree_name >"
        quota_switch: "< false | true >"
        security_style: "< native | ntfs | unix | mixed >"
        state: "present"

    - name: Modify Dtree By Name
      register: dtree_info
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< dtree_name >"
        new_name: "< new_dtree_name >"
        parent_id: "< fs_id >"
        parent_name: "< fs_name >"
        quota_switch: "< false | true >"
        security_style: "< native | ntfs | unix | mixed >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Dtree Detail By Name
      register: dtree_info
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        parent_id: "< fs_id >"
        parent_name: "< fs_name >"
        name: "< dtree_name >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - quota_switch
          - quota_switch_status
          - security_style
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Dtree Detail By ID
      register: dtree_info
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "< dtree_id >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - quota_switch
          - quota_switch_status
          - security_style
        state: "present"

    - name: Query Multi Dtree
      register: all_dtree
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        parent_id: "< fs_id >"
        parent_name: "< fs_name >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - parent_id
          - quota_switch
          - quota_switch_status
          - security_style
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Delete Dtree By Name
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< dtree_name >"
        parent_id: "< fs_id >"
        parent_name: "< fs_name >"
        vstore_id: "< vstore_id >"
        state: "absent"

    - name: Delete Dtree By ID
      huawei.enterprise.hw_enterprise_dtree:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ dtree_info.dtree_detail.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

dtree_detail

complex

Details of the Dtree.

Returned: When Dtree exists

Sample: {"id": "1", "name": "sample_dtree", "parent_id": "0", "quota_switch": "disabled", "quota_switch_status": "on", "security_style": "unix", "vstore_id": "0", "vstore_name": "System_vStore"}

id

string

The system generated ID given to the Dtree.

Returned: always

name

string

Name of the Dtree.

Returned: always

parent_id

string

FileSystem ID.

Returned: always

parent_name

string

FileSystem name.

Returned: always

quota_switch

string

Quota switch of the Dtree.

Returned: always

quota_switch_status

integer

Quota running status of the Dtree.

Returned: always

security_style

integer

Security style supported by a dtree directory of the Dtree.

Returned: always

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: "Dtree sample_dtree create successfully"

Authors

  • Huawei eSDK Ansible Team