huawei.enterprise.hw_enterprise_host module – Host 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_host.

Synopsis

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

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

access_mode

string

Host access mode.

Choices:

  • "balanced"

  • "asymmetric"

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 host.

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"

  • "os"

  • "ini_num"

  • "mapping_host_num"

  • "capacity"

  • "allcated_capacity"

  • "protection_capacity"

hostname

string / required

IP or FQDN of the huawei enterprise management system.

MultiIP config as ip1,ip2

hypermetro_path_optimized

string

Whether the host path to the local HyperMetro array is preferred.

Choices:

  • "no"

  • "yes"

id

string

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

ip

string

Host IP Addr.

location

string

Host location.

name

string

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

new_name

string

Host new unique name, Required for modify host name operation.

os

string

OS type, Required for create operation.

Choices:

  • "Linux"

  • "Windows"

  • "Solaris"

  • "HP-UX"

  • "AIX"

  • "XenServer"

  • "Mac OS"

  • "VMware ESX"

  • "LINUX_VIS"

  • "Windows Server 2012"

  • "Oracle VM"

  • "OpenVMS"

  • "Oracle_VM_Server_for_x86"

  • "Oracle_VM_Server_for_SPARC"

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 host 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 Host
      register: host_info
      huawei.enterprise.hw_enterprise_host:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< host_name >"
        os: "< Linux >"
        access_mode: "< balanced >"
        hypermetro_path_optimized: "< no >"
        location: "< location >"
        ip: "< host_ip >"
        description: "< description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Modify Host By ID
      register: host_info
      huawei.enterprise.hw_enterprise_host:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ host_info.host_detail.id }}"
        new_name: "< host_new_name >"
        access_mode: "< balanced >"
        hypermetro_path_optimized: "< no >"
        location: "< location >"
        description: "< description >"
        ip: "< host_ip >"
        state: "present"

    - name: Modify Host By Name
      register: host_info
      huawei.enterprise.hw_enterprise_host:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< host_name >"
        new_name: "< host_new_name >"
        access_mode: "< balanced >"
        hypermetro_path_optimized: "< no >"
        location: "< location >"
        ip: "< host_ip >"
        description: "< description >"
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Host Detail By Name
      register: host_info
      huawei.enterprise.hw_enterprise_host:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< host_name >"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - os
          - ip
          - running_status
          - ini_num
          - mapping_lun_num
          - capacity
          - allocated_capacity
          - protection_capacity
        vstore_id: "< vstore_id >"
        state: "present"

    - name: Query Host Detail By ID
      register: host_info
      huawei.enterprise.hw_enterprise_host:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ host_info.host_detail.id }}"
        filter:
          - id
          - name
          - vstore_name
          - vstore_id
          - os
          - ip
          - running_status
          - ini_num
          - mapping_lun_num
          - capacity
          - allocated_capacity
          - protection_capacity
          - hypermetro_path_optimized
          - description
          - access_mode
          - location
        state: "present"

    - name: Query Multi Host
      register: all_host
      huawei.enterprise.hw_enterprise_host:
        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
          - os
          - ip
          - running_status
          - ini_num
          - mapping_lun_num
          - capacity
          - allocated_capacity
          - protection_capacity
          - hypermetro_path_optimized
          - description
          - access_mode
          - location
        state: "present"

    - name: Delete Host By Name
      huawei.enterprise.hw_enterprise_host:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        name: "< host_name >"
        vstore_id: "< vstore_id >"
        state: "absent"

    - name: Delete Host By ID
      huawei.enterprise.hw_enterprise_host:
        hostname: "{{ hostname }}"
        username: "{{ username }}"
        password: "{{ password }}"
        valid_certs: "{{ valid_certs }}"
        socket_timeout: "{{ socket_timeout }}"
        storage_port: "{{ storage_port }}"
        use_log: "{{ use_log }}"
        id: "{{ host_info.host_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

host_detail

complex

Details of the host.

Returned: When host exists, if no host exist return {}

Sample: {"allocated_capacity": 5, "capacity": 10, "id": "1", "ip": "127.0.0.1", "name": "sample_host", "os": "Linux", "running_status": "27:online", "unit": "GB", "vstore_id": "0", "vstore_name": "System_vStore"}

allocated_capacity

integer

Used capacity of the host.

Returned: always

capacity

integer

total capacity of the host.

Returned: always

id

string

The system generated ID given to the host.

Returned: always

ip

string

IP address of the host.

Returned: always

name

string

Name of the host.

Returned: always

os

string

unit of all capacity.

Returned: always

running_status

string

Running status of the host.

Returned: always

unit

string

unit of all capacity.

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: "Host sample_host create successfully"

Authors

  • Huawei eSDK Ansible Team