# idrac_storage_controller Role to configure the physical disk, virtual disk, and storage controller settings on iDRAC9 based PowerEdge servers. ## Requirements ### Development Requirements to develop and contribute to the role. ``` ansible docker molecule python ``` ### Production Requirements to use the role. ``` ansible python ``` ### Ansible collections Collections required to use the role ``` dellemc.openmanage ``` ## Role Variables
Name Required Default Value Choices Type Description
hostname true str - iDRAC IP Address
username true str - iDRAC username
password true str - iDRAC user password
https_port false 443 int - iDRAC port.
validate_certs false true bool - If C(false), the SSL certificates will not be validated.
- Configure C(false) only on personally controlled sites where self-signed certificates are used.
ca_path false path - The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.
https_timeout false 30 int - The HTTPS socket level timeout in seconds.
controller_id true str - The ID of the controller on which the operations need to be performed.
volumes false dict - List of volume that belongs to I(controller_id).
     id true str - Fully Qualified Device Descriptor (FQDD) of the volume.
     dedicated_hot_spare false str - Fully Qualified Device Descriptor (FQDD) of the physical disk to assign the volume as a dedicated hot spare to a disk.
     encrypted false bool - To encrypt the virtual disk.
     expand_capacity_disk false str - Fully Qualified Device Descriptor (FQDD) of the disk for expanding the capacity with the existing disk.
- I(expand_capacity_size) is mutually exclusive with I(expand_capacity_disk).
     expand_capacity_size false str - Capacity of the virtual disk to be expanded in MB.
- Check mode and Idempotency is not supported for I(expand_capacity_size).
- Minimum Online Capacity Expansion size must be greater than 100 MB of the current size.
- I(expand_capacity_disk) is mutually exclusive with I(expand_capacity_size).
     blink false bool - Blinks the target virtual disk, and it always reports as changes found when check mode is enabled.
disks false dict - List of physical disks that belongs to I(controller_id).
     id true str - Fully Qualified Device Descriptor (FQDD) of the physical disk.
     blink false bool - Blinks the target physical disk, and it always reports as changes found when check mode is enabled.
     raid_state false 'raid', 'nonraid' str - Converts the disk form Non-Raid to Raid and vice versa.
- C(raid) converts the physical disk to Raid.
- C(nonraid) converts the physical disk to Non Raid.
     status false 'online', 'offline' str - Converts the disk form online to offline and vice versa.
- C(online) converts the physical disk status to online.
- C(offline) converts the physical disk status to offline.
     global_hot_spare false bool - Assigns a global hot spare or unassigns a hot spare.
- C(true) assigns the disk as a global hot spare.
- C(false) unassigns the disk as a hot spare.
     erase false bool - Securely erase a device.
- C(true) securely erase the disk.
- C(false) skips the secure erase operation.
reset_config false bool - To reset the controller.
set_controller_key false bool - Set the security key or enable controller encryption.
- If I(mode) is provided controller encryption operation is performed, otherwise sets the controller security key.
- I(key), and I(key_id) are required for this operation.
rekey false bool - Resets the key on the controller, and it always reports as changes found when check mode is enabled.
remove_key false bool - Remove the key on controllers.
key false str - A new security key passphrase that the encryption-capable controller uses to create the encryption key. The controller uses the encryption key to lock or unlock access to the Self-Encrypting Drive (SED). Only one encryption key can be created for each controller.
- This is mandatory when I(set_controller_key) is C(true), I(rekey) is C(true).
- The length of the key can be a maximum of 32 characters in length, where the expanded form of the special character is counted as a single character.
- The key must contain at least one character from each of the character classes are uppercase, lowercase, number, and special character.
key_id false str - This is a user supplied text label associated with the passphrase.
- This is mandatory when I(set_controller_key) is C(true), I(rekey) is C(true).
- The length of I(key_id) can be a maximum of 32 characters in length and should not have any spaces.
old_key false str - Security key passphrase used by the encryption-capable controller.
- This option is mandatory when I(rekey) is C(true).
mode false 'LKM', 'SEKM' str - Encryption mode of the encryption capable controller.
- This option is mandatory when I(rekey) is C(true) and for enabling controller encryption.
- C(SEKM) to choose mode as secure enterprise key manager.
- C(LKM) to choose mode as local key management.
attributes false dict - Dictionary of controller attributes and value pair.
- This feature is only supported for iDRAC9 with firmware version 6.00.00.00 and above.
- I(controller_id) is required for this operation.
- I(apply_time) and I(maintenance_window) is applicable for I(attributes).
- Use U(https://I(idrac_ip)/redfish/v1/Schemas/DellOemStorageController.json) to view the attributes.
apply_time false Immediate 'Immediate', 'OnReset', 'AtMaintenanceWindowStart', 'InMaintenanceWindowOnReset' str - Apply time of the I(attributes).
- This is applicable only to I(attributes).
- C(Immediate) Allows the user to immediately reboot the host and apply the changes. I(job_wait) is applicable.
- C(OnReset) Allows the user to apply the changes on the next reboot of the host server.
- C(AtMaintenanceWindowStart) Allows the user to apply the changes at the start of a maintenance window as specified in I(maintenance_window).
- C(InMaintenanceWindowOnReset) Allows the users to apply after a manual reset but within the maintenance window as specified in I(maintenance_window).
maintenance_window false dict - Option to schedule the maintenance window.
- This is required when I(apply_time) is C(AtMaintenanceWindowStart) or C(InMaintenanceWindowOnReset).
     start_time true str - The start time for the maintenance window to be scheduled.
- The format is YYYY-MM-DDThh:mm:ss.
- is the time offset from UTC that the current timezone set in iDRAC in the format is +05:30 for IST.
     duration false 900 int - The duration in seconds for the maintenance window.
## Fact variables
Name Sample Description
idrac_storage_controller_out
        
        {
            "assign_dedicated_spare": {
                "changed": false,
                "false_condition": "volumes.id is defined and volumes.dedicated_hot_spare is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "assign_global_spare": {
                "changed": false,
                "false_condition": "disks.id is defined and disks.global_hot_spare is true",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "blink_pd": {
                "changed": false,
                "false_condition": "disks.blink is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "blink_vd": {
                "changed": false,
                "false_condition": "volumes.blink is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "controller_attributes_config": {
                "changed": false,
                "false_condition": "attributes is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "controller_rekey": {
                "changed": false,
                "false_condition": "rekey is true",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "controller_reset_config": {
                "changed": false,
                "false_condition": "reset_config is true",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "enable_encryption": {
                "changed": false,
                "false_condition": "set_controller_key is true and key is defined and key_id is defined and mode is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "lock_vd": {
                "changed": false,
                "false_condition": "volumes.encrypted is true",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "oce_vd": {
                "changed": false,
                "false_condition": "volumes.expand_capacity_disk is defined or volumes.expand_capacity_size is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "physical_disk_raid_state": {
                "changed": false,
                "false_condition": "disks.raid_state is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "physical_disk_state": {
                "changed": false,
                "false_condition": "disks.status is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "remove_controller_key": {
                "changed": false,
                "false_condition": "remove_key is true",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "secure_erase": {
                "changed": false,
                "failed": false,
                "msg": "Successfully submitted the job that performs the 'SecureErase' operation.",
                "status": {
                    "ActualRunningStartTime": null,
                    "ActualRunningStopTime": null,
                    "CompletionTime": null,
                    "Description": "Job Instance",
                    "EndTime": "TIME_NA",
                    "Id": "JID_XXXXXXXXXXX",
                    "JobState": "ReadyForExecution",
                    "JobType": "RealTimeNoRebootConfiguration",
                    "Message": "New",
                    "MessageArgs": [],
                    "MessageId": "JCP000",
                    "Name": "Configure: RAID.Integrated.1-1",
                    "PercentComplete": 0,
                    "StartTime": "2024-07-09T01:35:18",
                    "TargetSettingsURI": null
                },
                "task": {
                    "id": "JID_XXXXXXXXXXX",
                    "uri": "/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs/JID_XXXXXXXXXXX"
                }
            },
            "set_controller_key": {
                "changed": false,
                "false_condition": "set_controller_key is true and key is defined and key_id is defined and mode is undefined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            },
            "unassign_hotspare": {
                "changed": false,
                "false_condition": "disks.global_hot_spare is false and disks.id is defined",
                "skip_reason": "Conditional result was False",
                "skipped": true
            }
        }
      
    
Returns the output of the idrac_storage_controller
## Example Playbook ``` - name: Reset controller configuration ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.0 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 reset_config: true ``` ``` - name: Set controller attributes ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 attributes: ControllerMode: HBA apply_time: Immediate ``` ``` - name: Set controller attributes at maintenance window ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 attributes: CheckConsistencyMode: Normal LoadBalanceMode: Disabled apply_time: AtMaintenanceWindowStart maintenance_window: start_time: "2022-09-30T05:15:40-05:00" duration: 1200 ``` ``` - name: Set controller encryption key ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 key: PassPhrase@123 key_id: MyKeyId123 set_controller_key: true ``` ``` - name: Rekey in LKM mode ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 rekey: true key: PassPhrase@123 key_id: mykeyid123 old_key: OldPhassParse@123 mode: LKM ``` ``` - name: Rekey in SEKM mode ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 rekey: true key: PassPhrase@123 key_id: mykeyid123 old_key: OldPhassParse@123 mode: SEKM ``` ``` - name: Remove controller encryption key ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 remove_key: true ``` ``` - name: Enable controller encryption ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 set_controller_key: true key: your_key@123 key_id: your_keyid@123 mode: LKM ``` ``` - name: Change physical disk state to online ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 status: online ``` ``` - name: Change physical disk state to offline ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 status: offline ``` ``` - name: Convert physical disk to RAID mode ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 raid_state: raid ``` ``` - name: Convert physical disk to Non-RAID mode ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 raid_state: nonraid ``` ``` - name: Assign dedicated hot spare. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 volumes: id: Disk.Virtual.0:RAID.Slot.1-1 dedicated_hot_spare: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 ``` ``` - name: Assign global hot spare. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 global_hot_spare: true ``` ``` - name: Unassign hot spare. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 global_hot_spare: false ``` ``` - name: Lock virtual drive. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 volumes: id: Disk.Virtual.0:RAID.Slot.1-1 encrypted: true ``` ``` - name: Online capacity expansion of volume using size. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 volumes: id: Disk.Virtual.0:RAID.Slot.1-1 expand_capacity_size: 362785 ``` ``` - name: Online capacity expansion of volume using target. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 volumes: id: Disk.Virtual.0:RAID.Slot.1-1 expand_capacity_disk: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 ``` ``` - name: Blink virtual drive. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 volumes: id: Disk.Virtual.0:RAID.Slot.1-1 blink: true ``` ``` - name: Unblink virtual drive. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 volumes: id: Disk.Virtual.0:RAID.Slot.1-1 blink: false ``` ``` - name: Blink physical disk. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 blink: true ``` ``` - name: Unblink physical disk. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password ca_path: "/path/to/ca_cert.pem" controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1 blink: false ``` ``` - name: Multiple operations on controller. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password validate_certs: false controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.3:Enclosure.Internal.0-1:RAID.Slot.1-1 global_hot_spare: false set_controller_key: true key: PassPhrase@12341 key_id: mykeyid123 mode: LKM attributes: CheckConsistencyMode: StopOnError CopybackMode: OnWithSMART apply_time: Immediate ``` ``` - name: Perform secure erase on physical disk. ansible.builtin.include_role: name: idrac_storage_controller vars: hostname: 192.168.0.1 username: username password: password validate_certs: false controller_id: RAID.Slot.1-1 disks: id: Disk.Bay.3:Enclosure.Internal.0-1:RAID.Slot.1-1 erase: true ``` ## Author Information ------------------ Dell Technologies
Felix Stephen Anthuvan (felix_s@dell.com) 2023
Abhishek Sinha (Abhishek.Sinha10@dell.com) 2024