huawei.enterprise.hw_enterprise_port_group module – Port 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_port_group.

Synopsis

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

  • Supports query all port group.

  • Supports add and remove port.

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 port group.

Required when create port 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"

  • "vstore_name"

  • "vstore_id"

  • "is_add_to_mapping_view"

  • "port_num"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

id

string

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

name

string

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

new_name

string

Port group new unique name, Required for modify port group source name.

operation

string / required

Required when need add or remove port.

Choices:

  • "associate"

  • "disassociate"

password

string / required

The password of the PowerStore host.

port_id

string

Id of eh_port of fc_port, Required when need add or remove port.

port_type

string

Type of port added to port group.

Choices:

  • "fc_port"

  • "eth_port"

socket_timeout

integer

Huawei Enterprise Storage rest api Timeout time.

Default: 60

state

string / required

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

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

Examples

---
  tasks:
    - name: Create Port Group
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< port_group_name >"
        description: "< port_group_description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Port Group Common Param By Name
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< port_group_name >"
        new_name: "< new_port_group_name >"
        description: "< port_group_description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Port Group Common Param By ID
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ port_group_info.port_group_detail.id }}"
        new_name: "< new_port_group_name >"
        description: "< port_group_description >"
        state: "present"

    - name: Associate Port To Port Group By ID
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ port_group_info.port_group_detail.id }}"
        port_type: "< fc_port | eth_port >"
        port_id: "< port_id >"
        operation: "associate"
        state: "present"

    - name: Associate Port To Port Group By Name
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< port_group_name >"
        port_type: "< fc_port | eth_port >"
        port_id: "< port_id >"
        operation: "associate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Disassociate Port To Port Group By ID
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ port_group_info.port_group_detail.id }}"
        port_type: "< fc_port | eth_port >"
        port_id: "< port_id >"
        operation: "disassociate"
        state: "present"

    - name: Disassociate Port To Port Group By Name
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< port_group_name >"
        port_type: "< fc_port | eth_port >"
        port_id: "< port_id >"
        operation: "disassociate"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Port Group By ID
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ port_group_info.port_group_detail.id }}"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - is_add_to_mapping_view
          - port_num
        state: "present"

    - name: Query Port Group By Name
      register: port_group_info
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< port_group_name >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - is_add_to_mapping_view
          - port_num
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Multi Port Group By Condition Param
      register: all_port_group
      huawei.enterprise.hw_enterprise_port_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
          - vstore_name
          - vstore_id
          - is_add_to_mapping_view
          - port_num
        state: "present"

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

    - name: Delete Port Group By ID
      huawei.enterprise.hw_enterprise_port_group:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ port_group_info.port_group_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

port_group_detail

complex

Details of the port group.

Returned: When port group exists

Sample: {"id": "1", "is_add_to_mapping_view": "true", "name": "sample_port_group", "port_num": 10, "vstore_id": "0", "vstore_name": "System_vStore"}

id

string

The system generated ID given to the port group.

Returned: always

is_add_to_mapping_view

string

Is port group add to mapping view or not.

Returned: always

name

string

Name of the port group.

Returned: always

port_num

integer

Number of port in port 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: "Port Group sample_port_group create successfully"

Authors

  • Huawei eSDK Ansible Team