huawei.enterprise.hw_enterprise_protect_group module – Protect 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_protect_group.

Synopsis

  • Supports the operations of create, modify, delete, add lun and remove lun for Protect group.

  • Support get the details of Protect group information

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

Protect group description.

filter

list / elements=string

Parameter required for all query operations.

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

Choices:

  • "protectGroupName"

  • "protectGroupId"

  • "vstoreId"

  • "vstoreName"

  • "lunGroupName"

  • "lunNum"

  • "snapshotGroupNum"

  • "protectGroupNum"

  • "cdgGroupNum"

  • "cloneGroupNum"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

Protect group unique id. Either id or name is required when operate Protect group.

id has higher priority than name when both pass to parameter.

lun_group_id

string

LUN group ID when creat a Protect group.

if Lun group id is indicate when create Protect group, you can not add lun to Protect group.

lun_id

string

LUN ID when add or remove to Protect group.

if Lun group id is indicate when create Protect group, you can not add lun to Protect group.

name

string

Protect group unique name. Either id or name is required when operate Protect group.

name has lower priority than id when both pass to parameter.

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 Protect group exist or not.

Choices:

  • "present"

  • "absent"

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 Protection Group
    register: protect_group_info
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      name: "< protect_group_name >"
      lun_group_id: "< lun_group_id >"
      description : "< description >"
      vstore_id: "< vstore_id >"
      state: "present"

  - name: Modify Protection Group By ID
    register: protect_group_info
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      id: "{{ protect_group_info.protection_group_detail.id }}"
      new_name: "< protect_group_new_name >"
      description : "< description >"
      state: "present"

  - name: Modify Protection Group By Name
    register: protect_group_info
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      name: "< protect_group_name >"
      new_name: "< protect_group_new_name >"
      description : "< description >"
      vstore_id: "< vstore_id >"
      state: "present"

  - name: Query Multi Protection Group
    register: all_protect_group
    huawei.enterprise.hw_enterprise_protect_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 >"
      state: "present"
      filter:
        - name
        - id
        - vstore_id
        - vstore_name
        - lun_group_name
        - lun_num
        - snapshot_group_num
        - cdp_group_num
        - clone_group_num

  - name: Query Protection Group By ID
    register: protect_group_info
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      id: "{{ protect_group_info.protection_group_detail.id }}"
      state: "present"
      filter:
        - name
        - id
        - vstore_id
        - vstore_name
        - lun_group_name
        - lun_num
        - snapshot_group_num
        - cdp_group_num
        - clone_group_num

  - name: Query Protection Group By Name
    register: protect_group_info
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      name: "< protect_group_name >"
      vstore_id: "< vstore_id >"
      state: "present"
      filter:
        - name
        - id
        - vstore_id
        - vstore_name
        - lun_group_name
        - lun_num
        - snapshot_group_num
        - cdp_group_num
        - clone_group_num

  - name: Delete Protection Group By ID
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      id: "{{ protect_group_info.protection_group_detail.id }}"
      state: "absent"

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

  - name: Add Lun To Protection Group
    register: protect_group_info
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      id: "{{ protect_group_info.protection_group_detail.id }}"
      operation: "add_lun"
      obj_type: "lun"
      lun_id: "< lun_id >"
      state: "present"

  - name: Remove Lun From Protection Group
    register: protect_group_info
    huawei.enterprise.hw_enterprise_protect_group:
      hostname: "{{ hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      valid_certs: "{{ valid_certs }}"
      socket_timeout: "{{ socket_timeout }}"
      storage_port: "{{ storage_port }}"
      use_log: "{{ use_log }}"
      operation: "remove_lun"
      id: "{{ protect_group_info.protection_group_detail.id }}"
      obj_type: "lun"
      lun_id: "< lun_id >"
      state: "present"

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

protection_group_detail

complex

Details of the Protect group.

Returned: When Protect group exists

Sample: {"cdpGroupNum": "3", "cloneGroupNum": "1", "id": "4d56e60-fc10-4f51-a698-84a664562f0d", "lunGroupName": "lunGroupName", "lunNum": "1", "name": "sample_host", "snapshotGroupNum": "0", "vstore_id:": "1", "vstore_name:": "vstore1"}

cdpGroupNum

string

Number of HyperCDP consistency groups.

Returned: success

cloneGroupNum

string

Number of clone consistency groups.

Returned: success

id

string

The system generated ID given to the Protect Group.

Returned: success

lunGroupName

string

LUN group name.

Returned: success

lunNum

string

Number of LUNs.

Returned: success

name

string

Name of the Protect Group.

Returned: success

snapshotGroupNum

string

Number of snapshot consistency groups.

Returned: success

vstore_id

string

id of storage vstore

Returned: success

vstore_name

string

name of storage vstore

Returned: success

remark

string

task execute remark

Returned: always

Sample: "Task sample_protect_group create successfully"

Authors

  • Huawei eSDK Ansible Team