dellemc.unity.host 模块 – 管理 Unity 上的主机操作

注意

此模块是 dellemc.unity 集合(版本 2.0.0)的一部分。

如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install dellemc.unity。您需要进一步的要求才能使用此模块,有关详细信息,请参阅 要求

要在 playbook 中使用它,请指定:dellemc.unity.host

dellemc.unity 1.1.0 中的新增功能

概要

  • 主机模块包含以下操作:创建主机、向主机添加启动器、从主机删除启动器、修改主机属性、获取主机详细信息、删除主机、向主机添加网络地址、从主机删除网络地址。

要求

执行此模块的主机需要满足以下要求。

  • Dell Unity 存储设备版本 5.1 或更高版本。

  • Ansible-core 2.14 或更高版本。

  • Python 3.9、3.10 或 3.11。

  • Storops Python SDK 1.2.11。

参数

参数

注释

description

字符串

主机描述。

host_id

字符串

主机的唯一标识符。

主机 ID 在创建期间自动生成。

除创建外,所有其他操作都需要 host_id 或 Ihost_name)。

host_name

字符串

主机的名称。

主机创建是必需的。

host_os

字符串

主机上运行的操作系统。

选项

  • "AIX"

  • "Citrix XenServer"

  • "HP-UX"

  • "IBM VIOS"

  • "Linux"

  • "Mac OS"

  • "Solaris"

  • "VMware ESXi"

  • "Windows Client"

  • "Windows Server"

initiator_state

字符串

启动器的状态。

选项

  • "present-in-host"

  • "absent-in-host"

initiators

列表 / elements=字符串

要添加到主机或从主机删除的启动器列表。

network_address

字符串

要添加到主机或从主机删除的网络地址。

输入有效的 IPV4 或主机名。

network_address_state

字符串

网络地址的状态。

选项

  • "present-in-host"

  • "absent-in-host"

new_host_name

字符串

主机的新名称。

仅在重命名主机操作中需要。

password

字符串 / 必需

Unity 管理服务器的密码。

port

整数

与 Unity 管理服务器通信所使用的端口号。

默认值: 443

state

字符串 / 必需

主机的状态。

选项

  • "present"

  • "absent"

unispherehost

字符串 / 必需

Unity 管理服务器的 IP 或 FQDN。

username

字符串 / 必需

Unity 管理服务器的用户名。

validate_certs

别名:verifycert

布尔值

用于指定是否验证 SSL 证书的布尔变量。

true - 表示应验证 SSL 证书。

false - 表示不应验证 SSL 证书。

选项

  • false

  • true ← (默认)

注释

注意

  • 不支持 check_mode

  • 此集合中名为“dellemc.unity”的模块旨在支持 Dell Unity 存储平台。

示例

- name: Create empty Host
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_name: "ansible-test-host"
    host_os: "Linux"
    description: "ansible-test-host"
    state: "present"

- name: Create Host with Initiators
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_name: "ansible-test-host-1"
    host_os: "Linux"
    description: "ansible-test-host-1"
    initiators:
      - "iqn.1994-05.com.redhat:c38e6e8cfd81"
      - "20:00:00:90:FA:13:81:8D:10:00:00:90:FA:13:81:8D"
    initiator_state: "present-in-host"
    state: "present"

- name: Modify Host using host_id
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_id: "Host_253"
    new_host_name: "ansible-test-host-2"
    host_os: "Mac OS"
    description: "Ansible tesing purpose"
    state: "present"

- name: Add Initiators to Host
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_name: "ansible-test-host-2"
    initiators:
      - "20:00:00:90:FA:13:81:8C:10:00:00:90:FA:13:81:8C"
    initiator_state: "present-in-host"
    state: "present"

- name: Get Host details using host_name
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_name: "ansible-test-host-2"
    state: "present"

- name: Get Host details using host_id
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_id: "Host_253"
    state: "present"

- name: Delete Host
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_name: "ansible-test-host-2"
    state: "absent"

- name: Add network address to Host
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_name: "{{host_name}}"
    network_address: "192.168.1.2"
    network_address_state: "present-in-host"
    state: "present"

- name: Delete network address from Host
  dellemc.unity.host:
    unispherehost: "{{unispherehost}}"
    username: "{{username}}"
    password: "{{password}}"
    validate_certs: "{{validate_certs}}"
    host_name: "{{host_name}}"
    network_address: "192.168.1.2"
    network_address_state: "absent-in-host"
    state: "present"

返回值

常见返回值记录在 此处,以下是此模块特有的字段

描述

changed

布尔值

资源是否已更改。

已返回: 始终

示例: true

host_details

字典

主机的详细信息。

已返回: 当主机存在时。

示例: {"auto_manage_type": "HostManageEnum.UNKNOWN", "datastores": null, "description": "ansible-test-host-1", "existed": true, "fc_host_initiators": [{"id": "HostInitiator_1", "name": "HostName_1", "paths": [{"id": "HostInitiator_1_Id1", "is_logged_in": true}, {"id": "HostInitiator_1_Id2", "is_logged_in": true}]}], "hash": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "health": {"UnityHealth": {"hash": 8764429420954}}, "host_container": null, "host_luns": [], "host_polled_uuid": null, "host_pushed_uuid": null, "host_uuid": null, "host_v_vol_datastore": null, "id": "Host_2198", "iscsi_host_initiators": [{"id": "HostInitiator_2", "name": "HostName_2", "paths": [{"id": "HostInitiator_2_Id1", "is_logged_in": true}, {"id": "HostInitiator_2_Id2", "is_logged_in": true}]}], "last_poll_time": null, "name": "ansible-test-host-1", "network_addresses": [], "os_type": "Linux", "registration_type": null, "storage_resources": null, "tenant": null, "type": "HostTypeEnum.HOST_MANUAL", "vms": null}

description

字符串

关于主机的描述。

返回: 成功

fc_host_initiators

列表 / elements=字符串

与主机关联的 FC 发起程序详细信息。

返回: 成功

id

字符串

FC 发起程序路径的唯一标识符。

返回: 成功

name

字符串

发起程序的 FC 限定名称 (WWN)。

返回: 成功

paths

列表 / elements=字符串

与 FC 发起程序关联的路径的详细信息。

返回: 成功

id

字符串

路径的唯一标识符。

返回: 成功

is_logged_in

布尔值

指示主机发起程序是否已登录到存储系统。

返回: 成功

host_luns

列表 / elements=字符串

附加到主机的 LUN 的详细信息。

返回: 成功

id

字符串

分配给主机的系统 ID。

返回: 成功

iscsi_host_initiators

列表 / elements=字符串

与主机关联的 ISCSI 发起程序的详细信息。

返回: 成功

id

字符串

ISCSI 发起程序路径的唯一标识符。

返回: 成功

name

字符串

发起程序的 ISCSI 限定名称 (IQN)。

返回: 成功

paths

列表 / elements=字符串

与 ISCSI 发起程序关联的路径的详细信息。

返回: 成功

id

字符串

路径的唯一标识符。

返回: 成功

is_logged_in

布尔值

指示主机发起程序是否已登录到存储系统。

返回: 成功

name

字符串

主机的名称。

返回: 成功

network_addresses

列表 / elements=字符串

映射到主机的网络地址列表。

返回: 成功

os_type

字符串

主机上运行的操作系统。

返回: 成功

type

字符串

主机的 HostTypeEnum。

返回: 成功

作者

  • Rajshree Khare (@kharer5)