dellemc.openmanage.ome_device_group 模块 – 在 OpenManage Enterprise 上向静态设备组添加或移除设备

注意

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

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

要安装它,请使用:ansible-galaxy collection install dellemc.openmanage。您需要其他要求才能使用此模块,请参阅 要求 以了解详情。

要在 playbook 中使用它,请指定:dellemc.openmanage.ome_device_group

dellemc.openmanage 3.3.0 中的新增功能

概要

  • 此模块允许向 OpenManage Enterprise 上的静态设备组添加或移除设备。

要求

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

  • python >= 3.9.6

  • netaddr >= 0.7.19

参数

参数

注释

ca_path

路径

在 dellemc.openmanage 5.0.0 中添加

包含用于验证的 CA 证书的隐私增强邮件 (PEM) 文件。

device_ids

列表 / 元素=整数

要添加到设备组或从设备组移除的设备的 ID 列表。

device_idsdevice_service_tagsip_addresses 互斥。

device_service_tags

列表 / 元素=字符串

要添加到设备组或从设备组移除的设备的服务标签列表。

device_service_tagsdevice_idsip_addresses 互斥。

group_id

整数

静态设备的 ID。

group_idname 互斥。

hostname

字符串 / 必填

OpenManage Enterprise IP 地址或主机名。

ip_addresses

列表 / 元素=字符串

要添加到设备组或从设备组移除的设备的 IP 列表。

ip_addressesdevice_idsdevice_service_tags 互斥。

支持的 IP 地址范围格式

  • 192.35.0.1

  • 10.36.0.0-192.36.0.255

  • 192.37.0.0/24

  • fe80::ffff:ffff:ffff:ffff

  • fe80::ffff:192.0.2.0/125

  • fe80::ffff:ffff:ffff:1111-fe80::ffff:ffff:ffff:ffff

注意 不支持主机名。

注意 ip_addresses 需要 python 的 netaddr 包才能处理 IP 地址。

注意 即使 ip_addresses 列表中提供的 IP 地址之一在 OpenManage Enterprise 中可用,此模块也会报告成功。只有在列表中提供的 IP 地址均不在 OpenManage Enterprise 中可用时,模块才会报告失败。

name

字符串

静态组的名称。

namegroup_id 互斥。

password

字符串

OpenManage Enterprise 密码。

如果未提供密码,则使用环境变量 OME_PASSWORD

示例:export OME_PASSWORD=password

port

整数

OpenManage Enterprise HTTPS 端口。

默认值: 443

state

字符串

present 允许将设备添加到静态设备组。

absent 允许从静态设备组中移除设备。

选项

  • "present" ← (默认)

  • "absent"

timeout

整数

在 dellemc.openmanage 5.0.0 中添加

以秒为单位的套接字级别超时。

默认值: 30

username

字符串

OpenManage Enterprise 用户名。

如果未提供用户名,则使用环境变量 OME_USERNAME

示例:export OME_USERNAME=username

validate_certs

布尔值

在 dellemc.openmanage 5.0.0 中添加

如果为 false,则不会验证 SSL 证书。

仅在使用自签名证书的个人控制站点上配置 false

在集合版本 5.0.0 之前,validate_certs 默认值为 false

选项

  • false

  • true ← (默认)

x_auth_token

字符串

在 dellemc.openmanage 9.3.0 中添加

身份验证令牌。

如果未提供 x_auth_token,则使用环境变量OME_X_AUTH_TOKEN

示例:export OME_X_AUTH_TOKEN=x_auth_token

备注

注意

  • 从可以直接访问 Dell OpenManage Enterprise 的系统运行此模块。

  • 此模块支持check_mode

示例

---
- name: Add devices to a static device group by using the group name and device IDs
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    name: "Storage Services"
    device_ids:
      - 11111
      - 11112
      - 11113

- name: Add devices to a static device group by using the group name and device service tags
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    name: "Storage Services"
    device_service_tags:
      - GHRT2RL
      - KJHDF3S
      - LKIJNG6

- name: Add devices to a static device group by using the group ID and device service tags
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    group_id: 12345
    device_service_tags:
      - GHRT2RL
      - KJHDF3S

- name: Add devices to a static device group by using the group name and IPv4 addresses
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    name: "Storage Services"
    ip_addresses:
      - 192.35.0.1
      - 192.35.0.5

- name: Add devices to a static device group by using the group ID and IPv6 addresses
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    group_id: 12345
    ip_addresses:
      - fe80::ffff:ffff:ffff:ffff
      - fe80::ffff:ffff:ffff:2222

- name: Add devices to a static device group by using the group ID and supported IPv4 and IPv6 address formats.
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    group_id: 12345
    ip_addresses:
      - 192.35.0.1
      - 10.36.0.0-192.36.0.255
      - 192.37.0.0/24
      - fe80::ffff:ffff:ffff:ffff
      - ::ffff:192.0.2.0/125
      - fe80::ffff:ffff:ffff:1111-fe80::ffff:ffff:ffff:ffff

- name: Remove devices from a static device group by using the group name and device IDs
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "absent"
    name: "Storage Services"
    device_ids:
      - 11111
      - 11112
      - 11113

- name: Remove devices from a static device group by using the group name and device service tags
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "absent"
    name: "Storage Services"
    device_service_tags:
      - GHRT2RL
      - KJHDF3S
      - LKIJNG6

- name: Remove devices from a static device group by using the group ID and device service tags
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "absent"
    group_id: 12345
    device_service_tags:
      - GHRT2RL
      - KJHDF3S

- name: Remove devices from a static device group by using the group name and IPv4 addresses
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "absent"
    name: "Storage Services"
    ip_addresses:
      - 192.35.0.1
      - 192.35.0.5

- name: Remove devices from a static device group by using the group ID and IPv6 addresses
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "absent"
    group_id: 12345
    ip_addresses:
      - fe80::ffff:ffff:ffff:ffff
      - fe80::ffff:ffff:ffff:2222

- name: Remove devices from a static device group by using the group ID and supported IPv4 and IPv6 address formats.
  dellemc.openmanage.ome_device_group:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    state: "absent"
    group_id: 12345
    ip_addresses:
      - 192.35.0.1
      - 10.36.0.0-192.36.0.255
      - 192.37.0.0/24
      - fe80::ffff:ffff:ffff:ffff
      - ::ffff:192.0.2.0/125
      - fe80::ffff:ffff:ffff:1111-fe80::ffff:ffff:ffff:ffff

返回值

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

描述

error_info

字典

HTTP 错误的详细信息。

返回:HTTP 错误时

示例:{"error": {"@Message.ExtendedInfo": [{"Message": "Unable to process the request because an error occurred.", "MessageArgs": [], "MessageId": "GEN1234", "RelatedProperties": [], "Resolution": "Retry the operation. If the issue persists, contact your system administrator.", "Severity": "Critical"}], "code": "Base.1.0.GeneralError", "message": "A general error has occurred. See ExtendedInfo for more information."}}

group_id

整数

组的ID。

返回:成功

示例:21078

ip_addresses_added

列表 / 元素=字符串

添加到设备组的IP地址。

返回:成功

示例:["21078"]

msg

字符串

设备组设置的整体状态。

返回:始终

示例:"['Successfully added member(s) to the device group.']"

作者

  • Felix Stephen (@felixs88)

  • Sajna Shetty (@Sajna-Shetty)

  • Abhishek Sinha (@Abhishek-Dell)