huawei.enterprise.hw_enterprise_mapping_view module – Mapping view 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_view.

Synopsis

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

  • Support query all mapping view on storage.

  • Support add or remove lun group.

  • Support add or remove host 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

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 Mapping view.

Required when create Mapping view.

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"

  • "parent_name"

  • "running_status"

  • "capacity"

  • "allocated_capacity"

  • "wwn"

  • "unit"

  • "description"

host_group_id

string

Id of host group which need to be add or remove.

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

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

lun_group_id

string

Id of lun group which need to be add or remove.

name

string

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

new_name

string

Mapping view new unique name, Required for modify name operation.

operation

string

Required when need add or remove host_group/lun_group.

Choices:

  • "associate"

  • "disassociate"

password

string / required

The password of the PowerStore host.

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

Define whether the mapping view 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

  • description param must be set when create mapping view.

  • The check_mode is not supported.

  • Host group associate must be earlier than Lun group, otherwise Lun group associate will failed.

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

Examples

---
  tasks:
    - name: Create Mapping View
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        description: "< mapping_view_description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Mapping View By Name
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        new_name: "< new_name >"
        description: "< mapping_view_description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Mapping View By ID
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ mapping_view_info.mapping_view_detail.id }}"
        new_name: "< new_name >"
        description: "< mapping_view_description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Associate Host Group To Mapping View By ID
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ mapping_view_info.mapping_view_detail.id }}"
        host_group_id: "< host_group_id >"
        operation: "associate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Associate Host Group To Mapping View By Name
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        host_group_id: "< host_group_id >"
        operation: "associate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Associate LUN Group To Mapping View By ID
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ mapping_view_info.mapping_view_detail.id }}"
        lun_group_id: "< lun_group_id >"
        operation: "associate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Associate LUN Group To Mapping View By Name
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        lun_group_id: "< lun_group_id >"
        operation: "associate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate LUN Group From Mapping View By ID
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ mapping_view_info.mapping_view_detail.id }}"
        lun_group_id: "< lun_group_id >"
        operation: "disassociate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate LUN Group From Mapping View By Name
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        lun_group_id: "< lun_group_id >"
        operation: "disassociate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate Host Group From Mapping View By ID
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ mapping_view_info.mapping_view_detail.id }}"
        host_group_id: "< host_group_id >"
        operation: "disassociate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate Host Group From Mapping View By Name
      register: all_mapping_view
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        host_group_id: "< host_group_id >"
        operation: "disassociate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Mapping View By ID
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ mapping_view_info.mapping_view_detail.id }}"
        vstore_id: "< vstore_id >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - lun_group_name
          - lun_group_id
          - host_group_name
          - host_group_id
          - host_name
          - host_id
          - description
        state: "present"

    - name: Query Mapping View By Name
      register: mapping_view_info
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        vstore_id: "< vstore_id >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - lun_group_name
          - lun_group_id
          - host_group_name
          - host_group_id
          - host_name
          - host_id
          - description
        state: "present"

    - name: Query Multi Mapping View
      register: all_lun_group
      huawei.enterprise.hw_enterprise_mapping_view:
        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
          - vstore_name
          - vstore_id
          - lun_group_name
          - lun_group_id
          - host_group_name
          - host_group_id
          - host_name
          - host_id
          - description
        state: "present"

    - name: Delete Mapping View By Name
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< mapping_view_name >"
        vstore_id: "< vstore_id >"
        state: "absent"

    - name: Delete Mapping View By ID
      huawei.enterprise.hw_enterprise_mapping_view:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ mapping_view_info.mapping_view_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

mapping_view_detail

complex

Details of the Mapping view.

Returned: When mapping view exists

Sample: {"host_group_id": "4", "host_group_name": "sample_host_group", "host_id": "2", "host_name": "sample_host", "id": "1", "lun_group_id": "3", "lun_group_name": "sample_lun_group", "name": "sample_mapping_view", "vstore_id": "0", "vstore_name": "System_vStore"}

host_group_id

string

The system generated ID given to the host group.

Returned: always

host_group_name

string

Name of the host_group.

Returned: always

host_id

string

The system generated ID given to the host.

Returned: always

host_name

string

Name of the host.

Returned: always

id

string

The system generated ID given to the Mapping view.

Returned: always

lun_group_id

string

The system generated ID given to the lun group.

Returned: always

lun_group_name

string

Name of the lun group.

Returned: always

name

string

Name of the Mapping view.

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: "Mapping view sample_mapping_view create successfully"

Authors

  • Huawei eSDK Ansible Team