dellemc.openmanage.ome_profile 模块 – 在 OpenManage Enterprise 上创建、修改、删除、分配、取消分配和迁移配置文件

注意

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

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

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

要在剧本中使用它,请指定:dellemc.openmanage.ome_profile

dellemc.openmanage 3.1.0 中的新增功能

概要

  • 此模块允许在 OpenManage Enterprise 上创建、修改、删除、分配、取消分配和迁移配置文件。

需求

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

  • python >= 3.9.6

参数

参数

注释

attributes

字典

用于 modifyassign 的属性。

属性

列表 / 元素=字典

commandmodify 时,要修改的属性列表。

commandassign 时,要覆盖的属性列表。

如果属性 ID 可用,则使用 Id。如果不可用,则使用以逗号分隔的 I (DisplayName)。有关使用 DisplayName 的更多详细信息,请参阅提供的示例。

选项

字典

提供不同的关闭选项。

commandassign 时适用。

Schedule

字典

配置文件部署计划。

commandassign 时适用。

boot_to_network_iso

字典

共享 ISO 的详细信息。

commandcreateassignmodify 时适用。

boot_to_network

布尔值 / 必需

启用或禁用网络共享。

选项

  • false

  • true

iso_path

字符串

指定完整的 ISO 路径,包括共享名称。

iso_timeout

整数

设置网络 ISO 文件将保持映射到目标设备的时间(小时)。

选项

  • 1

  • 2

  • 4 ← (默认)

  • 8

  • 16

share_ip

字符串

网络共享的 IP 地址。

share_password

字符串

share_typeCIFS 时的用户密码。

share_type

字符串

网络共享的类型。

选项

  • "NFS"

  • "CIFS"

share_user

字符串

share_typeCIFS 时的用户名。

workgroup

字符串

share_typeCIFS 时的用户工作组。

ca_path

路径

dellemc.openmanage 5.0.0 中新增

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

command

字符串

create 创建新的配置文件。

modify 修改现有配置文件。只能修改 namedescriptionboot_to_network_isoattributes

delete 删除现有配置文件。

assign 将现有配置文件部署到目标设备并返回任务 ID。

unassign 从指定的 target 取消分配配置文件并返回任务 ID。

migrate 迁移现有配置文件并返回任务 ID。

选项

  • "create" ← (默认)

  • "modify"

  • "delete"

  • "assign"

  • "unassign"

  • "migrate"

description

字符串

配置文件的描述。

device_id

整数

目标设备的 ID。

commandassignmigrate 时适用。

此选项与 device_service_tag 互斥。

device_service_tag

字符串

目标设备的标识符。

这通常是 7 到 8 个字符的长度。

commandassignmigrate 时适用。

此选项与 device_id 互斥。

commandassign 时,如果设备不存在,则自动部署配置文件。

filters

字典

根据选定的条件筛选配置文件。

commanddeleteunassign 时适用。

这支持子选项 ProfileIds,它接受配置文件 ID 列表。

此模块还支持使用子选项 *Filters* 的 OData 过滤器表达式。

有关可用的过滤选项,请参阅 OpenManage Enterprise REST API 指南。

警告 当此选项与 unassign 一起使用时,不会返回任何受影响配置文件的任务 ID。

force

布尔值

提供一个选项,即使无法联系源设备,也可以强制迁移配置文件。

此选项仅在 *command* 为 migrate 时适用。

选项

  • false ← (默认)

  • true

hostname

字符串 / 必填

OpenManage Enterprise 或 OpenManage Enterprise Modular 的 IP 地址或主机名。

name

字符串

配置文件的名称。

这适用于修改、删除、分配、取消分配和迁移操作。

此选项与 *name_prefix* 和 *number_of_profiles* 互斥。

name_prefix

字符串

创建配置文件时提供的名称用作前缀,后跟 OpenManage Enterprise 为其分配的编号。

此选项仅适用于创建操作。

此选项与 *name* 互斥。

默认值: "Profile"

new_name

字符串

配置文件的新名称。

仅在 *command* 为 modify 时适用。

number_of_profiles

整数

要创建的配置文件数量。

此选项仅在使用 create 命令时与 *name_prefix* 一起使用。

此选项与 *name* 互斥。

OpenManage Enterprise 最多可以创建 100 个配置文件。

默认值: 1

password

字符串

OpenManage Enterprise 或 OpenManage Enterprise Modular 的密码。

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

示例:export OME_PASSWORD=password

port

整数

OpenManage Enterprise 或 OpenManage Enterprise Modular 的 HTTPS 端口。

默认值: 443

template_id

整数

模板的 ID。

此选项仅在 *command* 为 create 时适用。

此选项与 *template_name* 互斥。

template_name

字符串

用于创建配置文件的模板名称。

此选项仅在 *command* 为 create 时适用。

此选项与 *template_id* 互斥。

timeout

整数

dellemc.openmanage 5.0.0 中新增

套接字级别超时(秒)。

默认值: 30

username

字符串

OpenManage Enterprise 或 OpenManage Enterprise Modular 的用户名。

如果未提供用户名,则使用环境变量 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

  • 对已分配配置文件的 assign 操作不会重新部署。

示例

---
- name: Create two profiles from a template
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    template_name: "template 1"
    name_prefix: "omam_profile"
    number_of_profiles: 2

- name: Create profile with NFS share
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: create
    template_name: "template 1"
    name_prefix: "omam_profile"
    number_of_profiles: 1
    boot_to_network_iso:
      boot_to_network: true
      share_type: NFS
      share_ip: "192.168.0.1"
      iso_path: "path/to/my_iso.iso"
      iso_timeout: 8

- name: Create profile with CIFS share
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: create
    template_name: "template 1"
    name_prefix: "omam_profile"
    number_of_profiles: 1
    boot_to_network_iso:
      boot_to_network: true
      share_type: CIFS
      share_ip: "192.168.0.2"
      share_user: "username"
      share_password: "password"
      workgroup: "workgroup"
      iso_path: "\\path\\to\\my_iso.iso"
      iso_timeout: 8

- name: Modify profile name with NFS share and attributes
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: modify
    name: "Profile 00001"
    new_name: "modified profile"
    description: "new description"
    boot_to_network_iso:
      boot_to_network: true
      share_type: NFS
      share_ip: "192.168.0.3"
      iso_path: "path/to/my_iso.iso"
      iso_timeout: 8
    attributes:
      Attributes:
        - Id: 4506
          Value: "server attr 1"
          IsIgnored: false
        - Id: 4507
          Value: "server attr 2"
          IsIgnored: false
        # Enter the comma separated string as appearing in the Detailed view on GUI
        # System -> Server Topology -> ServerTopology 1 Aisle Name
        - DisplayName: 'System, Server Topology, ServerTopology 1 Aisle Name'
          Value: Aisle 5
          IsIgnored: false

- name: Delete a profile using profile name
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "delete"
    name: "Profile 00001"

- name: Delete profiles using filters
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "delete"
    filters:
      SelectAll: true
      Filters: =contains(ProfileName,'Profile 00002')

- name: Delete profiles using profile list filter
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "delete"
    filters:
      ProfileIds:
        - 17123
        - 16124

- name: Assign a profile to target along with network share
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: assign
    name: "Profile 00001"
    device_id: 12456
    boot_to_network_iso:
      boot_to_network: true
      share_type: NFS
      share_ip: "192.168.0.1"
      iso_path: "path/to/my_iso.iso"
      iso_timeout: 8
    attributes:
      Attributes:
        - Id: 4506
          Value: "server attr 1"
          IsIgnored: true
      Options:
        ShutdownType: 0
        TimeToWaitBeforeShutdown: 300
        EndHostPowerState: 1
        StrictCheckingVlan: true
      Schedule:
        RunNow: true
        RunLater: false

- name: Unassign a profile using profile name
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "unassign"
    name: "Profile 00003"

- name: Unassign profiles using filters
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "unassign"
    filters:
      SelectAll: true
      Filters: =contains(ProfileName,'Profile 00003')

- name: Unassign profiles using profile list filter
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "unassign"
    filters:
      ProfileIds:
        - 17123
        - 16123

- name: Migrate a profile
  dellemc.openmanage.ome_profile:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    command: "migrate"
    name: "Profile 00001"
    device_id: 12456

返回值

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

描述

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."}}

job_id

整数

当 *command* 为 assignmigrateunassign 时创建的任务 ID。

assignunassign 操作如果配置文件自动部署,则不会触发任务。

返回: 当 *command* 为 assignmigrateunassign

示例: 14123

msg

字符串

配置文件操作的总体状态。

返回: 始终返回

示例: "Successfully created 2 profile(s)."

profile_ids

列表 / 元素=字符串

已创建配置文件的 ID。

返回: 当 *command* 为 create

示例: [1234, 5678]

作者

  • Jagadeesh N V (@jagadeeshnv)