dellemc.openmanage.idrac_certificates 模块 – 配置 iDRAC 的证书

注意

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

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

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

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

dellemc.openmanage 5.5.0 中的新增功能

概要

  • 此模块允许在 iDRAC 上生成证书签名请求、导入和导出证书。

要求

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

  • python >= 3.9.6

参数

参数

注释

ca_path

路径

在 dellemc.openmanage 5.0.0 中添加

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

cert_params

字典

生成签名请求的证书参数。

common_name

字符串 / 必需

证书的通用名称。

country_code

字符串 / 必需

申请证书的实体所在的国家/地区的国家/地区代码。

email_address

字符串

与 CSR 关联的电子邮件。

locality_name

字符串 / 必需

申请证书的实体所在的城市或其他位置。

organization_name

字符串 / 必需

与组织关联的名称。

organization_unit

字符串 / 必需

与组织单元关联的名称。例如部门名称。

state_name

字符串 / 必需

申请证书的实体所在的州。

subject_alt_name

列表 / elements=字符串

与请求关联的备用域名。

默认值: []

certificate_path

路径

如果 commandimport,则为证书文件的绝对路径。

如果 commandgenerate_csrexport,则为具有写入权限的目录路径。

certificate_type

字符串

iDRAC 证书的类型。

HTTPS Dell 自签名 SSL 证书。

CA 证书颁发机构 (CA) 签名的 SSL 证书。

CUSTOMCERTIFICATE 自定义 PKCS12 证书和私钥。仅在 iDRAC 固件版本 7.00.00.00 及更高版本上支持导出自定义证书。

CSC 自定义签名 SSL 证书。

CLIENT_TRUST_CERTIFICATE 客户端信任证书。

选项

  • "HTTPS" ← (默认)

  • "CA"

  • "CUSTOMCERTIFICATE"

  • "CSC"

  • "CLIENT_TRUST_CERTIFICATE"

command

字符串

generate_csr,生成 CSR。这需要 cert_paramscertificate_path。这仅适用于 HTTPS

import,导入证书文件。这需要 certificate_path

export,导出证书。这需要 certificate_path

reset,将证书重置为默认设置。这仅适用于 HTTPS

选项

  • "import"

  • "export"

  • "generate_csr" ← (默认)

  • "reset"

idrac_ip

字符串 / 必需

iDRAC IP 地址。

idrac_password

别名:idrac_pwd

字符串

iDRAC 用户密码。

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

示例:export IDRAC_PASSWORD=password

idrac_port

整数

iDRAC 端口。

默认值: 443

idrac_user

字符串

iDRAC 用户名。

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

示例:export IDRAC_USERNAME=username

passphrase

字符串

如果要导入的证书受密码保护,则使用此密码字符串。

reset

布尔值

在证书操作后重置 iDRAC。

commandimportreset 时适用。

选项

  • false

  • true ← (默认)

resource_id

字符串

资源的 Redfish ID。

ssl_key

路径

在 dellemc.openmanage 8.6.0 中添加

私钥或 SSL 密钥文件的绝对路径。

仅当 commandimportcertificate_typeHTTPS 时适用。

在固件版本 6.00.02.00 及更高版本上支持将 SSL 密钥上传到 iDRAC。

timeout

整数

在 dellemc.openmanage 5.0.0 中添加

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

默认值: 30

validate_certs

布尔值

在 dellemc.openmanage 5.0.0 中添加

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

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

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

选项

  • false

  • true ← (默认)

wait

整数

iDRAC 在重置后启动的最大等待时间(以秒为单位)。

commandimportresetresettrue 时适用。

默认值: 300

x_auth_token

字符串

在 dellemc.openmanage 9.3.0 中添加

身份验证令牌。

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

示例:export IDRAC_X_AUTH_TOKEN=x_auth_token

说明

注意

  • iDRAC 固件版本 6.10.80.00 及以上版本支持证书操作。

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

  • 此模块支持 check_mode

  • 此模块支持 IPv4 和 IPv6 地址。

示例

---
- name: Generate HTTPS certificate signing request
  dellemc.openmanage.idrac_certificates:
    idrac_ip: "192.168.0.1"
    idrac_user: "user_name"
    idrac_password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "generate_csr"
    certificate_type: "HTTPS"
    certificate_path: "/home/omam/mycerts"
    cert_params:
      common_name: "sample.domain.com"
      organization_unit: "OrgUnit"
      locality_name: "Bangalore"
      state_name: "Karnataka"
      country_code: "IN"
      email_address: "[email protected]"
      organization_name: "OrgName"
      subject_alt_name:
        - 192.198.2.1

- name: Import a HTTPS certificate.
  dellemc.openmanage.idrac_certificates:
    idrac_ip: "192.168.0.1"
    idrac_user: "user_name"
    idrac_password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "import"
    certificate_type: "HTTPS"
    certificate_path: "/path/to/cert.pem"

- name: Import an HTTPS certificate along with its private key.
  dellemc.openmanage.idrac_certificates:
    idrac_ip: "192.168.0.1"
    idrac_user: "user_name"
    idrac_password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "import"
    certificate_type: "HTTPS"
    certificate_path: "/path/to/cert.pem"
    ssl_key: "/path/to/private_key.pem"

- name: Export a HTTPS certificate.
  dellemc.openmanage.idrac_certificates:
    idrac_ip: "192.168.0.1"
    idrac_user: "user_name"
    idrac_password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "export"
    certificate_type: "HTTPS"
    certificate_path: "/home/omam/mycert_dir"

- name: Import a CSC certificate.
  dellemc.openmanage.idrac_certificates:
    idrac_ip: "192.168.0.1"
    idrac_user: "user_name"
    idrac_password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "import"
    certificate_type: "CSC"
    certificate_path: "/path/to/cert.pem"

- name: Import a custom certificate with a passphrase.
  dellemc.openmanage.idrac_certificates:
    idrac_ip: "192.168.0.1"
    idrac_user: "user_name"
    idrac_password: "user_password"
    command: "import"
    certificate_type: "CUSTOMCERTIFICATE"
    certificate_path: "/path/to/idrac_cert.p12"
    passphrase: "cert_passphrase"
    reset: false

- name: Export a Client trust certificate.
  dellemc.openmanage.idrac_certificates:
    idrac_ip: "192.168.0.1"
    idrac_user: "user_name"
    idrac_password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "export"
    certificate_type: "CLIENT_TRUST_CERTIFICATE"
    certificate_path: "/home/omam/mycert_dir"

返回值

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

描述

certificate_path

字符串

csr 或导出的证书文件路径

返回值:commandexportgenerate_csr

示例:"/home/ansible/myfiles/cert.pem"

error_info

字典

HTTP 错误的详细信息。

返回值:在 HTTP 错误时

示例:{"error": {"@Message.ExtendedInfo": [{ "Message": "由于发生错误,无法处理请求。", "MessageArgs": [], "MessageId": "GEN1234", "RelatedProperties": [], "Resolution": "重试操作。如果问题仍然存在,请联系系统管理员。", "Severity": "严重"}], "code": "Base.1.0.GeneralError", "message": "发生了一般错误。有关详细信息,请参阅 ExtendedInfo。"}}

msg

字符串

证书配置操作的状态。

返回值:始终

示例:"已成功执行 'generate_csr' 证书操作。"

作者

  • Jagadeesh N V(@jagadeeshnv)

  • Rajshekar P(@rajshekarp87)

  • Kristian Lamb V(@kristian_lamb)