huawei.enterprise.hw_enterprise_lun_group module – Lun Group 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_lun_group.

Synopsis

  • Supports the provisioning operations on a lun group such as create, modify, associate, disassociate, delete and get the details of a lun group.

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

app_type

string

Application type.

Required for v5 Storage when created LUN Group

Choices:

  • "other"

  • "oracle"

  • "exchange"

  • "sqlserver"

  • "vmware"

  • "hyper_v"

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

Description of the lun group.

Required when create lun group.

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"

  • "description"

  • "capcity"

  • "used_capacity"

  • "protection_capacity"

  • "lun_number"

  • "is_add_mapping_view"

  • "vstore_id"

  • "vstore_name"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

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

lun_id

string

Id of lun, Required when associate or disassociate lun. Mutually exclusive with “name”, Priority is higher than lun_name.

lun_name

string

Id of lun, Required when associate or disassociate lun. Mutually exclusive with “id”, Priority is higher than lun_id.

name

string

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

new_name

string

Lun group new unique name, Required for modify lun group source name.

operation

string

Required when need associate or disassociate object.

Choices:

  • "associate"

  • "disassociate"

password

string / required

The password of the PowerStore host.

snapshot_id

string

Id of snapshot, Required when associate or disassociate snapshot. Mutually exclusive with “name”, Priority is higher than snapshot_name.

snapshot_name

string

Id of snapshot, Required when associate or disassociate snapshot. Mutually exclusive with “id”, Priority is higher than snapshot_id.

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the lun group 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.

  • Description must be set when create lun group.

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

Examples

---
  tasks:
    - name: Create LUN Group
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        description: "< lun_group_description >"
        app_type: "< other | oracle | exchange | sqlserver | vmware | hyper_v >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify LUN Group By Name
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        new_name: "< new_name >"
        description: "< lun_group_description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify LUN Group By ID
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_group_info.lun_group_detail.id }}"
        new_name: "< new_name >"
        description: "< lun_group_description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Associate LUN To LUN Group By ID
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_group_info.lun_group_detail.id }}"
        lun_id: "< lun_id >"
        lun_name: "< lun_name >"
        associate_type: "< lun >"
        operation: "< associate >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Associate LUN To LUN Group By Name
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        lun_id: "< lun_id >"
        lun_name: "< lun_name >"
        associate_type: "< lun >"
        operation: "< associate >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Associate Snapshot To LUN Group By ID
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_group_info.lun_group_detail.id }}"
        snapshot_id: "< snapshot_id >"
        snapshot_name: "< snapshot_name >"
        operation: "< associate >"
        associate_type: "< snapshot >"
        vstore_id: "{{ vstore_id }}"
        state: "present"

    - name: Associate Snapshot To LUN Group By Name
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        snapshot_id: "< snapshot_id >"
        snapshot_name: "< snapshot_name >"
        operation: "< associate >"
        associate_type: "< snapshot >"
        vstore_id: "{{ vstore_id }}"
        state: "present"

    - name: Disassociate LUN To LUN Group By ID
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_group_info.lun_group_detail.id }}"
        lun_id: "< lun_id >"
        lun_name: "< lun_name >"
        associate_type: "< lun >"
        operation: "< disassociate >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate LUN to LUN Group By Name
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        lun_id: "< lun_id >"
        lun_name: "< lun_name >"
        associate_type: "< lun >"
        operation: "< disassociate >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate Snapshot To LUN Group By ID
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_group_info.lun_group_detail.id }}"
        snapshot_id: "< snapshot_id >"
        snapshot_name: "< snapshot_name >"
        operation: "< disassociate >"
        associate_type: "< snapshot >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate Snapshot To LUN Group By Name
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        snapshot_id: "< snapshot_id >"
        snapshot_name: "< snapshot_name >"
        operation: "< disassociate >"
        associate_type: "< snapshot >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query LUN Group By ID
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "< lun_group_id >"
        vstore_id: "< vstore_id >"
        filter:
          - id
          - name
          - description
          - vstore_id
          - vstore_name
          - capacity
          - used_capacity
          - protection_capacity
          - lun_number
          - is_add_mapping_view
        state: "present"

    - name: Query LUN Group By Name
      register: lun_group_info
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        vstore_id: "< vstore_id >"
        filter:
          - id
          - name
          - description
          - vstore_id
          - vstore_name
          - capacity
          - used_capacity
          - protection_capacity
          - lun_number
          - is_add_mapping_view
        state: "present"

    - name: Query Multi LUN Group
      register: all_lun_group
      huawei.enterprise.hw_enterprise_lun_group:
        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
          - name
          - description
          - vstore_id
          - vstore_name
          - capacity
          - used_capacity
          - protection_capacity
          - lun_number
          - is_add_mapping_view
        state: "present"

    - name: Delete LUN Group By Name
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< lun_group_name >"
        vstore_id: "< vstore_id >"
        state: "absent"

    - name: Delete LUN Group By ID
      huawei.enterprise.hw_enterprise_lun_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ lun_group_info.lun_group_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

lun_group_detail

complex

Details of the lun group.

Returned: When lun group exists

Sample: {"capacity": "1024", "id": "1", "is_add_to_mapping_view": "true", "lun_number": 10, "name": "sample_lun_group", "protection_capacity": "1024", "used_capacity": "1024", "vstore_id": "0", "vstore_name": "System_vStore"}

capacity

string

Total capacity of lun group.

Returned: always

id

string

The system generated ID given to the lun group.

Returned: always

is_add_mapping_view

string

Is lun group add to mapping view or not.

Returned: always

lun_number

string

Number of lun in lun group.

Returned: always

name

string

Name of the lun group.

Returned: always

protection_capacity

string

Data protection capacity of lun group.

Returned: always

used_capacity

string

Used capacity of lun group.

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: "Lun Group sample_lun_group create successfully"

Authors

  • Huawei eSDK Ansible Team