huawei.enterprise.hw_enterprise_mapping module – Mapping 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_mapping.

Synopsis

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

  • Support mapping between host and lun.

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:

  • "host_id"

  • "lun_id"

  • "port_group_id"

  • "lun_name"

  • "host_name"

  • "host_lun_id"

  • "port_group_name"

  • "vstore_id"

  • "vstore_name"

host_id

string

Mapping host id, Mutually exclusive with host_name, Priority is higher than host_name.

Either host_name or host_id must be configured.

host_id, lun_id, port_group_id must be set up together.

host_lun_id

string

Start value of the host LUN ID.

host_name

string

Mapping host name, Mutually exclusive with host_id, Priority is higher than host_id.

Either host_name or host_id must be configured.

host_name, lun_name, port_group_name must be set up together.

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

lun_id

string

Mapping lun id, Mutually exclusive with lun_name, Priority is higher than lun_name.

Either lun_name or lun_id must be configured.

host_id, lun_id, port_group_id must be set up together.

lun_name

string

Mapping lun name, Mutually exclusive with lun_id, Priority is higher than lun_id.

Either lun_name or lun_id must be configured.

host_name, lun_name, port_group_name must be set up together.

password

string / required

The password of the PowerStore host.

port_group_id

string

Mapping port group id, Mutually exclusive with port_group_name.

Priority is higher than port_group_name.

host_id, lun_id, port_group_id must be set up together.

port_group_name

string

Mapping port group name, Mutually exclusive with port_group_id.

Priority is higher than port_group_id.

host_name, lun_name, port_group_name must be set up together.

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the mapping 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:System_vStore 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 Mapping for host and lun by id
      register: mapping_info
      huawei.enterprise.hw_enterprise_mapping:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        host_id: "< host_id >"
        lun_id: "< lun_id >"
        port_group_id: "< port_group_id >"
        host_lun_id: "< host_lun_id >"
        state: "present"

    - name: Create Mapping for host and lun by name
      register: mapping_info
      huawei.enterprise.hw_enterprise_mapping:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        host_name: "< host_name >"
        lun_name: "< lun_name >"
        port_group_name: "< port_group_name >"
        host_lun_id: "< host_lun_id >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Mapping host_lun_id for host and lun
      register: mapping_info
      huawei.enterprise.hw_enterprise_mapping:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        host_id: "< host_id >"
        lun_id: "< lun_id >"
        host_lun_id: "< host_lun_id >"
        state: "present"

    - name: Query Mapping detail by name
      register: mapping_info
      huawei.enterprise.hw_enterprise_mapping:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        host_name: "< host_name >"
        lun_name: "< lun_name >"
        filter:
          - host_id
          - lun_id
          - host_name
          - lun_name
          - host_lun_id
          - port_group_id
          - port_group_name
          - vstore_id
          - vstore_name
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Mapping detail by id
      register: mapping_info
      huawei.enterprise.hw_enterprise_mapping:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        host_id: "< host_id >"
        lun_id: "< lun_id >"
        filter:
          - host_id
          - lun_id
          - host_name
          - lun_name
          - host_lun_id
          - port_group_id
          - port_group_name
          - vstore_id
          - vstore_name
        state: "present"

    - name: Delete Mapping by name
      huawei.enterprise.hw_enterprise_mapping:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        host_name: "< host_name >"
        lun_name: "< lun_name >"
        vstore_id: "< vstore_id >"
        state: "absent"

    - name: Delete Mapping by id
      huawei.enterprise.hw_enterprise_mapping:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        host_id: "< host_id >"
        lun_id: "< lun_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

mapping_detail

complex

Details of the mapping.

Returned: When mapping exists

Sample: {"host_id": "1", "host_lun_id": "1", "host_name": "host_01", "lun_id": "1", "lun_name": "lun_01", "port_group_id": "1", "port_group_name": "port_group_01", "vstore_id": "0", "vstore_name": "System_vStore"}

host_id

string

The host id of the mapping.

Returned: always

host_lun_id

string

Host LUN ID.

Returned: always

host_name

string

The host name of the mapping.

Returned: always

lun_id

string

The LUN id of the mapping.

Returned: always

lun_name

string

The LUN name of the mapping.

Returned: always

port_group_id

string

The port group id of the mapping.

Returned: success

port_group_name

string

The port group name of the mapping.

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: "Mapping between lun_01 and host_01 create successfully"

Authors

  • Huawei eSDK Ansible Team