dellemc.openmanage.idrac_redfish_storage_controller 模块 – 配置物理磁盘、虚拟磁盘和存储控制器设置

注意

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

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

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

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

dellemc.openmanage 2.1.0 中的新增功能

概要

  • 此模块允许用户配置物理磁盘、虚拟磁盘和存储控制器的设置。

需求

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

  • python >= 3.9.6

参数

参数

注释

apply_time

字符串

attributes 的应用时间。

这只适用于attributes

Immediate 允许用户立即重启主机并应用更改。job_wait 可用。

OnReset 允许用户在下次重启主机服务器时应用更改。

AtMaintenanceWindowStart 允许用户在维护窗口开始时应用,如maintenance_window中指定。

InMaintenanceWindowOnReset 允许在手动重置后但在maintenance_window中指定的维护窗口内应用。

选项

  • "Immediate" ← (默认)

  • "OnReset"

  • "AtMaintenanceWindowStart"

  • "InMaintenanceWindowOnReset"

attributes

字典

控制器属性和值对的字典。

此功能仅支持固件版本 6.00.00.00 及更高版本的 iDRAC9

此操作需要controller_id

apply_timemaintenance_window 适用于 attributes

attributescommand 互斥。

使用 https://I(idrac_ip/redfish/v1/Schemas/DellOemStorageController.json) 查看属性。

baseuri

字符串 / 必需

目标带外控制器的 IP 地址。例如 - <ipaddress>:<port>。

ca_path

路径

在 dellemc.openmanage 5.0.0 中添加

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

command

字符串

这些操作可能需要系统重置,具体取决于控制器的功能。

ResetConfig - 删除所有虚拟磁盘并在物理磁盘上取消分配所有热备盘。此操作需要controller_id

AssignSpare - 将物理磁盘分配为虚拟磁盘的专用或全局热备盘。此操作需要target

SetControllerKey - 在控制器上设置密钥,该密钥用于加密本地密钥管理 (LKM) 中的驱动器。此操作需要controller_idkeykey_id

RemoveControllerKey - 删除控制器上的加密密钥。此操作需要controller_id

ReKey - 重置控制器上的密钥,并且在启用检查模式时始终报告为发现更改。此操作需要controller_idold_keykey_idkey

UnassignSpare - 取消分配全局或专用热备盘。此操作需要target

EnableControllerEncryption - 在支持驱动器加密的控制器上启用本地密钥管理 (LKM) 或安全企业密钥管理器 (SEKM)。此操作需要controller_idkeykey_id

BlinkTarget - 闪烁目标虚拟驱动器或物理磁盘,并且在启用检查模式时始终报告为发现更改。此操作需要targetvolume_id

UnBlinkTarget - 取消闪烁目标虚拟驱动器或物理磁盘,并且在启用检查模式时始终报告为发现更改。此操作需要targetvolume_id

ConvertToRAID - 将磁盘从非 RAID 转换为 RAID。此操作需要target

ConvertToNonRAID - 将磁盘从 RAID 转换为非 RAID。此操作需要target

ChangePDStateToOnline - 设置磁盘状态为在线。此操作需要target参数。

ChangePDStateToOffline - 设置磁盘状态为离线。此操作需要target参数。

LockVirtualDisk - 加密虚拟磁盘。此操作需要volume_id参数。

OnlineCapacityExpansion - 扩展虚拟磁盘大小。此操作需要volume_id参数,以及targetsize参数。

SecureErase - 安全地删除物理磁盘上的所有数据。此选项适用于自加密驱动器 (SED)、即时擦除 (ISE) 驱动器和 PCIe SSD 设备(驱动器和卡)。驱动器必须处于就绪状态。此操作需要controller_idtarget参数,target必须是单个物理磁盘 ID。如果安全擦除需要重新启动,作业将被调度并等待job_wait_time中指定的秒数,为了减少等待时间,请将job_wait_time设置为最小值或将job_wait设置为false。

选项

  • "重置配置"

  • "分配备件"

  • "设置控制器密钥"

  • "移除控制器密钥"

  • "重新加密"

  • "取消分配备件"

  • "启用控制器加密"

  • "闪烁目标"

  • "停止闪烁目标"

  • "转换为 RAID"

  • "转换为非 RAID"

  • "ChangePDStateToOnline"

  • "ChangePDStateToOffline"

  • "LockVirtualDisk"

  • "OnlineCapacityExpansion"

  • "SecureErase"

控制器ID

字符串

存储控制器的完全限定设备描述符 (FQDD)。例如:‘RAID.Slot.1-1’。

commandResetConfigSetControllerKeyRemoveControllerKeyReKeyEnableControllerEncryption时,此选项是必需的。

此选项对于attributes是必需的。

job_wait

布尔值

提供模块是否需要等待作业完成的选项。

apply_timeImmediatecommandSecureErase时,此选项适用于attributes

选项

  • false ← (默认)

  • true

job_wait_timeout

整数

作业跟踪停止之前,作业完成的最大等待时间(秒)。

job_waittrue时,此选项适用。

注意:当commandSecureErase时,如果安全擦除需要重新启动,作业将被调度并等待job_wait_time中指定的秒数,为了减少等待时间,请将job_wait_time的值设置得更小或将job_wait设置为false。

默认值: 120

密钥

字符串

支持加密的控制器用来创建加密密钥的新安全密钥密码。控制器使用加密密钥来锁定或解锁对自加密驱动器 (SED) 的访问。每个控制器只能创建一个加密密钥。

commandSetControllerKeyReKeyEnableControllerEncryptionmodeLKM时,此选项是必需的。

密钥长度最多可以为 32 个字符,其中特殊字符的展开形式算作单个字符。

密钥必须至少包含来自以下每个字符类的一个字符:大写字母、小写字母、数字和特殊字符。

key_id

字符串

这是与密码关联的用户提供的文本标签。

commandSetControllerKeyReKeyEnableControllerEncryptionmodeLKM时,此选项是必需的。

key_id的长度最多可以为 32 个字符,并且不能包含任何空格。

维护窗口

字典

用于安排维护窗口的选项。

apply_timeAtMaintenanceWindowStartInMaintenanceWindowOnReset时,此选项是必需的。

持续时间

整数

维护窗口的持续时间(秒)。

默认值: 900

开始时间

字符串 / 必需

计划维护窗口的开始时间。

格式为 YYYY-MM-DDThh:mm:ss<offset>

<offset> 是当前 iDRAC 中设置的时区相对于 UTC 的时间偏移量,格式为:IST 为 +05:30。

模式

字符串

支持加密的控制器的加密模式。

此选项仅当commandReKeyEnableControllerEncryption时适用。

SEKM 需要 iDRAC 上的安全企业密钥管理器许可证。

LKM 选择本地密钥模式。

选项

  • "LKM" ← (默认)

  • "SEKM"

旧密钥

字符串

支持加密的控制器使用的安全密钥密码。

commandReKeymodeLKM时,此选项是必需的。

密码

字符串

目标带外控制器的密码。

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

示例:export IDRAC_PASSWORD=password

大小

整数

要扩展的虚拟磁盘容量(MB)。

对于size,不支持检查模式和幂等性。

最小在线容量扩展大小必须大于当前大小的 100 MB。

commandOnlineCapacityExpansion时,sizetarget互斥。

目标

别名:drive_id

列表 / 元素=字符串

目标物理驱动器的完全限定设备描述符 (FQDD)。

commandAssignSpareUnassisgnSpareChangePDStateToOnlineChangePDStateToOfflineConvertToRAIDConvertToNonRAID时,此选项是必需的。

如果volume_id未指定或为空,则当commandAssignSpare时,此物理驱动器将被分配为全局热备。

commandOnlineCapacityExpansion时,targetsize互斥。

注意:全局或专用热备只能为物理磁盘分配一次,当commandAssignSpare时,无法重新分配。

超时

整数

在 dellemc.openmanage 5.0.0 中添加

套接字级别超时(秒)。

默认值: 30

用户名

字符串

目标带外控制器的用户名。

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

示例:export IDRAC_USERNAME=username

验证证书

布尔值

在 dellemc.openmanage 5.0.0 中添加

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

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

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

选项

  • false

  • true ← (默认)

卷ID

列表 / 元素=字符串

卷的完全限定设备描述符 (FQDD)。

如果commandAssignSpareBlinkTargetUnBlinkTargetLockVirtualDisk,则适用。

如果commandBlinkTargetUnBlinkTarget,则需要volume_idtarget参数,如果两者都指定,则考虑target

要了解可以为其分配热备的卷数,请参阅 iDRAC Redfish API 文档。

x_auth_token

字符串

在 dellemc.openmanage 9.3.0 中添加

身份验证令牌。

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

示例:export IDRAC_X_AUTH_TOKEN=x_auth_token

注意

注意

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

  • 此模块在 iDRAC9 上受支持。

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

  • commandReKeyBlinkTargetUnBlinkTarget时,此模块始终报告为发现更改。

  • 此模块支持check_mode

示例

---
- name: Assign dedicated hot spare
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    volume_id:
      - "Disk.Virtual.0:RAID.Slot.1-1"
    target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - assign_dedicated_hot_spare

- name: Assign global hot spare
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - assign_global_hot_spare

- name: Unassign hot spare
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
    command: UnassignSpare
  tags:
    - un-assign-hot-spare

- name: Set controller encryption key
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "SetControllerKey"
    controller_id: "RAID.Slot.1-1"
    key: "PassPhrase@123"
    key_id: "mykeyid123"
  tags:
    - set_controller_key

- name: Rekey in LKM mode
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "ReKey"
    controller_id: "RAID.Slot.1-1"
    key: "NewPassPhrase@123"
    key_id: "newkeyid123"
    old_key: "OldPassPhrase@123"
  tags:
    - rekey_lkm

- name: Rekey in SEKM mode
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "ReKey"
    controller_id: "RAID.Slot.1-1"
    mode: "SEKM"
  tags:
    - rekey_sekm

- name: Remove controller key
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "RemoveControllerKey"
    controller_id: "RAID.Slot.1-1"
  tags:
    - remove_controller_key

- name: Reset controller configuration
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "ResetConfig"
    controller_id: "RAID.Slot.1-1"
  tags:
    - reset_config

- name: Enable controller encryption
  idrac_redfish_storage_controller:
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    ca_path: "/path/to/ca_cert.pem"
    command: "EnableControllerEncryption"
    controller_id: "RAID.Slot.1-1"
    mode: "LKM"
    key: "your_Key@123"
    key_id: "your_Keyid@123"
  tags:
    - enable-encrypt

- name: Blink physical disk.
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: BlinkTarget
    target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - blink-target

- name: Blink virtual drive.
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: BlinkTarget
    volume_id: "Disk.Virtual.0:RAID.Slot.1-1"
  tags:
    - blink-volume

- name: Unblink physical disk.
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: UnBlinkTarget
    target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - unblink-target

- name: Unblink virtual drive.
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: UnBlinkTarget
    volume_id: "Disk.Virtual.0:RAID.Slot.1-1"
  tags:
    - unblink-drive

- name: Convert physical disk to RAID
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "ConvertToRAID"
    target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - convert-raid

- name: Convert physical disk to non-RAID
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "ConvertToNonRAID"
    target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - convert-non-raid

- name: Change physical disk state to online.
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "ChangePDStateToOnline"
    target: "Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - pd-state-online

- name: Change physical disk state to offline.
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "ChangePDStateToOnline"
    target: "Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1"
  tags:
    - pd-state-offline

- name: Lock virtual drive
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    command: "LockVirtualDisk"
    volume_id: "Disk.Virtual.0:RAID.SL.3-1"
  tags:
    - lock

- name: Online Capacity Expansion of a volume using target
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    ca_path: "/path/to/ca_cert.pem"
    command: "OnlineCapacityExpansion"
    volume_id: "Disk.Virtual.0:RAID.Integrated.1-1"
    target:
      - "Disk.Bay.2:Enclosure.Internal.0-0:RAID.Integrated.1-1"
  tags:
    - oce_target

- name: Online Capacity Expansion of a volume using size
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
    ca_path: "/path/to/ca_cert.pem"
    command: "OnlineCapacityExpansion"
    volume_id: "Disk.Virtual.0:RAID.Integrated.1-1"
    size: 362785
  tags:
    - oce_size

- name: Set controller attributes.
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    controller_id: "RAID.Slot.1-1"
    attributes:
      ControllerMode: "HBA"
    apply_time: "OnReset"
  tags:
    - controller-attribute

- name: Configure controller attributes at Maintenance window
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    controller_id: "RAID.Slot.1-1"
    attributes:
      CheckConsistencyMode: Normal
      CopybackMode: "Off"
      LoadBalanceMode: Disabled
    apply_time: AtMaintenanceWindowStart
    maintenance_window:
      start_time: "2022-09-30T05:15:40-05:00"
      duration: 1200

- name: Perform Secure Erase operation on SED drive
  dellemc.openmanage.idrac_redfish_storage_controller:
    baseuri: "192.168.0.1:443"
    username: "user_name"
    password: "user_password"
    ca_path: "/path/to/ca_cert.pem"
    controller_id: "RAID.Slot.1-1"
    command: "SecureErase"
    target: "Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1"

返回值

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

描述

error_info

字典

HTTP 错误的详细信息。

返回:HTTP 错误时

示例:{"error": {"@Message.ExtendedInfo": [{"Message": "由于请求的HTTP方法不允许,因此无法运行该方法。", "MessageArgs": [], "[email protected]": 0, "MessageId": "iDRAC.1.6.SYS402", "RelatedProperties": [], "[email protected]": 0, "Resolution": "输入有效的HTTP方法并重试操作。有关有效方法的信息,请参阅支持网站上提供的Redfish用户指南。", "Severity": "Informational"}], "code": "Base.1.0.GeneralError", "message": "发生一般错误。有关更多信息,请参阅ExtendedInfo"}}

msg

字符串

存储控制器配置操作的总体状态。

返回:始终

示例:"已成功提交执行AssignSpare操作的作业"

status

字典

已提交作业的状态。

返回:始终

示例:{"ActualRunningStartTime": "2022-02-09T04:42:41", "ActualRunningStopTime": "2022-02-09T04:44:00", "CompletionTime": "2022-02-09T04:44:00", "Description": "作业实例", "EndTime": "TIME_NA", "Id": "JID_444033604418", "JobState": "Completed", "JobType": "RealTimeNoRebootConfiguration", "Message": "作业已成功完成。", "MessageArgs": [], "MessageId": "PR19", "Name": "配置:RAID.Integrated.1-1", "PercentComplete": 100, "StartTime": "2022-02-09T04:42:40", "TargetSettingsURI": null}

task

字典

已创建作业的ID和URI资源。

返回:成功

示例:{"id": "JID_XXXXXXXXXXXXX", "uri": "/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_XXXXXXXXXXXXX"}

作者

  • Jagadeesh N V (@jagadeeshnv)

  • Felix Stephen (@felixs88)

  • Husniya Hameed (@husniya_hameed)

  • Abhishek Sinha (@ABHISHEK-SINHA10)