dellemc.openmanage.ome_template 模块 – 在 OpenManage Enterprise 上创建、修改、部署、删除、导出、导入和克隆模板
注意
此模块是 dellemc.openmanage 集合(版本 9.9.0)的一部分。
如果您使用的是 ansible
包,您可能已经安装了此集合。 它不包含在 ansible-core
中。 要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install dellemc.openmanage
。 您需要进一步的要求才能使用此模块,有关详细信息,请参阅要求。
要在 playbook 中使用它,请指定:dellemc.openmanage.ome_template
。
dellemc.openmanage 2.0.0 中的新增功能
概要
此模块在 OpenManage Enterprise 上创建、修改、部署、删除、导出、导入和克隆模板。
要求
执行此模块的主机需要以下要求。
python >= 3.9.6
参数
参数 |
注释 |
---|---|
模板操作的有效负载数据。 此选项中的所有变量都添加为 属性:要在部署模板中修改的属性的字典列表(如果有)。 当 I (command) 为 名称:模板的名称。 当 I (command) 为 描述:模板的描述。 当 I (command) 为 Fqdds:这允许使用指定参考服务器中的组件创建模板。 必须在逗号分隔的字符串中指定以下一个或多个值:iDRAC、System、BIOS、NIC、LifeCycleController、RAID 和 EventFilters。 如果未指定任何值,则选择默认值“All”。 当 I (command) 为 选项:用于控制设备关闭或模板部署后的最终电源状态的选项。 这适用于 计划:提供立即或在指定时间安排部署任务的选项。 当 I (command) 为 NetworkBootIsoModel:用于指定 ISO 部署详细信息的有效负载。 当 I (command) 为 内容:模板的 XML 内容。 当 I (command) 为 类型:模板类型 ID,指示支持配置的设备类型,例如机箱和服务器。 当 I (command) 为 TypeId:模板类型 ID,指示支持配置的设备类型,例如机箱和服务器。 当 I (command) 为 有关更多详细信息,请参阅 OpenManage Enterprise API 参考指南。 |
|
包含用于验证的 CA 证书的隐私增强邮件 (PEM) 文件。 |
|
选择
|
|
当 I (命令) 为 请提供至少一个必需选项 device_id、device_service_tag 或 device_group_names。 默认值: |
|
当 command 为 必须提供 device_id 或 device_service_tag 中的一个,或者两者都可适用。 默认值: |
|
当 I (命令) 为 必须提供 device_id 或 device_service_tag 中的一个,或者两者都可适用。 默认值: |
|
OpenManage Enterprise 或 OpenManage Enterprise Modular IP 地址或主机名。 |
|
提供等待作业完成的选项。 当 command 为 选择
|
|
job_wait 的最长等待时间(以秒为单位)。作业仅在此持续时间内被跟踪。 当 job_wait 为 默认值: |
|
OpenManage Enterprise 或 OpenManage Enterprise Modular 密码。 如果未提供密码,则使用环境变量 示例: export OME_PASSWORD=password |
|
OpenManage Enterprise 或 OpenManage Enterprise Modular HTTPS 端口。 默认值: |
|
现有模板的 ID。 当 command 为 此选项与 template_name 互斥。 |
|
现有模板的名称。 当 command 为 此选项与 template_id 互斥。 |
|
选择 OME 模板的视图类型。 当 command 为 选择
|
|
套接字级别的超时时间(以秒为单位)。 默认值: |
|
OpenManage Enterprise 或 OpenManage Enterprise Modular 用户名。 如果未提供用户名,则使用环境变量 示例: export OME_USERNAME=username |
|
如果 仅在个人控制的使用自签名证书的站点上配置 在集合版本 选择
|
|
身份验证令牌。 如果未提供 x_auth_token,则使用环境变量 示例: export OME_X_AUTH_TOKEN=x_auth_token |
注释
注意
从可以直接访问 Dell OpenManage Enterprise 的系统运行此模块。
此模块支持
check_mode
。
示例
---
- name: Create a template from a reference device
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
device_id: 25123
attributes:
Name: "New Template"
Description: "New Template description"
- name: Modify template name, description, and attribute value
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "modify"
template_id: 12
attributes:
Name: "New Custom Template"
Description: "Custom Template Description"
# Attributes to be modified in the template.
# For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails
# This section is optional
Attributes:
- Id: 1234
Value: "Test Attribute"
IsIgnored: false
- name: Modify template name, description, and attribute using detailed view
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "modify"
template_id: 12
attributes:
Name: "New Custom Template"
Description: "Custom Template Description"
Attributes:
# Enter the comma separated string as appearing in the Detailed view on GUI
# NIC -> NIC.Integrated.1-1-1 -> NIC Configuration -> Wake On LAN1
- DisplayName: 'NIC, NIC.Integrated.1-1-1, NIC Configuration, Wake On LAN'
Value: Enabled
IsIgnored: false
# System -> LCD Configuration -> LCD 1 User Defined String for LCD
- DisplayName: 'System, LCD Configuration, LCD 1 User Defined String for LCD'
Value: LCD str by OMAM
IsIgnored: false
- name: Deploy template on multiple devices
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "deploy"
template_id: 12
device_id:
- 12765
- 10173
device_service_tag:
- 'SVTG123'
- 'SVTG456'
- name: Deploy template on groups
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "deploy"
template_id: 12
device_group_names:
- server_group_1
- server_group_2
- name: Deploy template on multiple devices along with the attributes values to be modified on the target devices
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "deploy"
template_id: 12
device_id:
- 12765
- 10173
device_service_tag:
- 'SVTG123'
attributes:
# Device specific attributes to be modified during deployment.
# For information on any attribute id, use API /TemplateService/Templates(Id)/Views(Id)/AttributeViewDetails
# This section is optional
Attributes:
# specific device where attribute to be modified at deployment run-time.
# The DeviceId should be mentioned above in the 'device_id' section.
# Service tags not allowed.
- DeviceId: 12765
Attributes:
- Id: 15645
Value: "0.0.0.0"
IsIgnored: false
- DeviceId: 10173
Attributes:
- Id: 18968,
Value: "hostname-1"
IsIgnored: false
- name: Deploy template and Operating System (OS) on multiple devices
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "deploy"
template_id: 12
device_id:
- 12765
device_service_tag:
- 'SVTG123'
attributes:
# Include this to install OS on the devices.
# This section is optional
NetworkBootIsoModel:
BootToNetwork: true
ShareType: "NFS"
IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
IsoPath: "/home/iso_path/filename.iso"
ShareDetail:
IpAddress: "192.168.0.2"
ShareName: "sharename"
User: "share_user"
Password: "share_password"
Options:
EndHostPowerState: 1
ShutdownType: 0
TimeToWaitBeforeShutdown: 300
Schedule:
RunLater: true
RunNow: false
- name: "Deploy template on multiple devices and changes the device-level attributes. After the template is deployed,
install OS using its image"
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "deploy"
template_id: 12
device_id:
- 12765
- 10173
device_service_tag:
- 'SVTG123'
- 'SVTG456'
attributes:
Attributes:
- DeviceId: 12765
Attributes:
- Id: 15645
Value: "0.0.0.0"
IsIgnored: false
- DeviceId: 10173
Attributes:
- Id: 18968,
Value: "hostname-1"
IsIgnored: false
NetworkBootIsoModel:
BootToNetwork: true
ShareType: "NFS"
IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
IsoPath: "/home/iso_path/filename.iso"
ShareDetail:
IpAddress: "192.168.0.2"
ShareName: "sharename"
User: "share_user"
Password: "share_password"
Options:
EndHostPowerState: 1
ShutdownType: 0
TimeToWaitBeforeShutdown: 300
Schedule:
RunLater: true
RunNow: false
- name: Delete template
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "delete"
template_id: 12
- name: Export a template
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "export"
template_id: 12
# Start of example to export template to a local xml file
- name: Export template to a local xml file
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "export"
template_name: "my_template"
register: result
- name: Save template into a file
ansible.builtin.copy:
content: "{{ result.Content}}"
dest: "/path/to/exported_template.xml"
# End of example to export template to a local xml file
- name: Clone a template
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "clone"
template_id: 12
attributes:
Name: "New Cloned Template Name"
- name: Import template from XML content
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "import"
attributes:
Name: "Imported Template Name"
# Template Type from TemplateService/TemplateTypes
Type: 2
# xml string content
Content: "<SystemConfiguration Model=\"PowerEdge R940\" ServiceTag=\"SVCTAG1\"
TimeStamp=\"Tue Sep 24 09:20:57.872551 2019\">\n<Component FQDD=\"AHCI.Slot.6-1\">\n<Attribute
Name=\"RAIDresetConfig\">True</Attribute>\n<Attribute Name=\"RAIDforeignConfig\">Clear</Attribute>\n
</Component>\n<Component FQDD=\"Disk.Direct.0-0:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready
</Attribute>\n<Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n
<Component FQDD=\"Disk.Direct.1-1:AHCI.Slot.6-1\">\n<Attribute Name=\"RAIDPDState\">Ready</Attribute>\n
<Attribute Name=\"RAIDHotSpareStatus\">No</Attribute>\n</Component>\n</SystemConfiguration>\n"
- name: Import template from local XML file
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "import"
attributes:
Name: "Imported Template Name"
Type: 2
Content: "{{ lookup('ansible.builtin.file', '/path/to/xmlfile') }}"
- name: "Deploy template and Operating System (OS) on multiple devices."
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "deploy"
template_id: 12
device_id:
- 12765
device_service_tag:
- 'SVTG123'
attributes:
# Include this to install OS on the devices.
# This section is optional
NetworkBootIsoModel:
BootToNetwork: true
ShareType: "CIFS"
IsoTimeout: 1 # allowable values(1,2,4,8,16) in hours
IsoPath: "/home/iso_path/filename.iso"
ShareDetail:
IpAddress: "192.168.0.2"
ShareName: "sharename"
User: "share_user"
Password: "share_password"
Options:
EndHostPowerState: 1
ShutdownType: 0
TimeToWaitBeforeShutdown: 300
Schedule:
RunLater: true
RunNow: false
- name: Create a compliance template from reference device
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "create"
device_service_tag:
- "SVTG123"
template_view_type: "Compliance"
attributes:
Name: "Configuration Compliance"
Description: "Configuration Compliance Template"
Fqdds: "BIOS"
- name: Import a compliance template from XML file
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
command: "import"
template_view_type: "Compliance"
attributes:
Name: "Configuration Compliance"
Content: "{{ lookup('ansible.builtin.file', './test.xml') }}"
Type: 2
- name: Create a template from a reference device with Job wait as false
dellemc.openmanage.ome_template:
hostname: "192.168.0.1"
username: "username"
password: "password"
ca_path: "/path/to/ca_cert.pem"
device_id: 25123
attributes:
Name: "New Template"
Description: "New Template description"
Fqdds: iDRAC,BIOS,
job_wait: false
返回值
常见的返回值已在此处记录 此处,以下是此模块特有的字段
键 |
描述 |
---|---|
导出的模板的 XML 内容。此内容可以写入 xml 文件。 已返回: 成功,当 command 为 示例: |
|
已在其上部署模板的设备映射。 已返回: command 为 示例: |
|
HTTP 错误的详细信息。 已返回: HTTP 错误时 示例: |
|
模板操作的总体状态。 已返回: 总是 示例: |
|
用于 已返回: 成功,当 command 为 示例: |
|
用于 已返回: 成功,当 command 为 示例: |