Skip to content

Commit

Permalink
[idrac_system_erase] - Erase of system and storage components (#729)
Browse files Browse the repository at this point in the history
* Initial code of system component erase

* Addressed doc review comments

---------

Co-authored-by: Sachin Apagundi <[email protected]>
Co-authored-by: Shivam Sharma <[email protected]>
  • Loading branch information
3 people authored Sep 23, 2024
1 parent abe319f commit 2c5ad3f
Show file tree
Hide file tree
Showing 9 changed files with 1,346 additions and 10 deletions.
8 changes: 6 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@ You may obtain a copy of the License at
| [idrac_diagnostics](modules/idrac_diagnostics.rst) |||
| [idrac_firmware](modules/idrac_firmware.rst) |||
| [idrac_firmware_info](modules/idrac_firmware_info.rst) |||
| [idrac_lifecycle_controller_jobs](modules/idrac_lifecycle_controller_jobs.rst) | ||
| [idrac_license](modules/idrac_license.rst) | ||
| [idrac_lifecycle_controller_job_status_info](modules/idrac_lifecycle_controller_job_status_info.rst) |||
| [idrac_lifecycle_controller_jobs](modules/idrac_lifecycle_controller_jobs.rst) |||
| [idrac_lifecycle_controller_logs](modules/idrac_lifecycle_controller_logs.rst) |||
| [idrac_lifecycle_controller_status_info](modules/idrac_lifecycle_controller_status_info.rst) |||
| [idrac_network_attributes](modules/idrac_network_attributes.rst) |||
| [idrac_network](modules/idrac_network.rst) |||
| [idrac_network_attributes](modules/idrac_network_attributes.rst) |||
| [idrac_os_deployment](modules/idrac_os_deployment.rst) |||
| [idrac_redfish_storage_controller](modules/idrac_redfish_storage_controller.rst) |||
| [idrac_reset](modules/idrac_reset.rst) |||
| [idrac_secure_boot](modules/idrac_secure_boot.rst) |||
| [idrac_server_config_profile](modules/idrac_server_config_profile.rst) |||
| [idrac_session](modules/idrac_session.rst) |||
| [idrac_storage_volume](modules/idrac_storage_volume.rst) |||
| [idrac_support_assist](modules/idrac_support_assists.rst) |||
| [idrac_syslog](modules/idrac_syslog.rst) |||
| [idrac_system_erase](modules/idrac_system_erase.rst) |||
| [idrac_system_info](modules/idrac_system_info.rst) |||
| [idrac_timezone_ntp](modules/idrac_timezone_ntp.rst) |||
| [idrac_user](modules/idrac_user.rst) |||
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/idrac_diagnostics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ Parameters
ignore_certificate_warning (optional, str, off)
Ignores the certificate warning while connecting to Share and is only applicable when \ :emphasis:`share\_type`\ is \ :literal:`https`\ .

\ :literal:`off`\ ignores the certificate warning.
\ :literal:`on`\ ignores the certificate warning.

\ :literal:`on`\ does not ignore the certificate warning.
\ :literal:`off`\ does not ignore the certificate warning.


proxy_support (optional, str, off)
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/idrac_license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ Parameters
ignore_certificate_warning (optional, str, off)
Ignores the certificate warning while connecting to Share and is only applicable when \ :emphasis:`share\_type`\ is \ :literal:`https`\ .

\ :literal:`off`\ ignores the certificate warning.
\ :literal:`on`\ ignores the certificate warning.

\ :literal:`on`\ does not ignore the certificate warning.
\ :literal:`off`\ does not ignore the certificate warning.


proxy_support (optional, str, off)
Expand Down
188 changes: 188 additions & 0 deletions docs/modules/idrac_system_erase.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
.. _idrac_system_erase_module:


idrac_system_erase -- Erase system and storage components of the server
=======================================================================

.. contents::
:local:
:depth: 1


Synopsis
--------

This module allows you to erase system components such as iDRAC, BIOS, DIAG, and so forth. You can also erase storage components such as PERC NV cache, non-volatile memory, cryptographic erase of physical disks, and so on of the server



Requirements
------------
The below requirements are needed on the host that executes this module.

- python \>= 3.9.6



Parameters
----------

component (True, list, None)
List of system and storage components that can be deleted.

The following are the supported components. AllApps BIOS CryptographicErasePD DIAG DPU DrvPack IDRAC LCData NonVolatileMemory OverwritePD PERCNVCache ReinstallFW vFlash


power_on (optional, bool, False)
This parameter allows you to power on the server after the erase operation is completed. This is applicable when :emphasis:`job\_wait` is :literal:`true`.

:literal:`true` power on the server.

:literal:`false` does not power on the server.


job_wait (optional, bool, True)
Whether to wait till completion of the job. This is applicable when :emphasis:`power\_on` is :literal:`true`.

:literal:`true` waits for job completion.

:literal:`false` does not wait for job completion.


job_wait_timeout (optional, int, 1200)
The maximum wait time of :emphasis:`job\_wait` in seconds. The job is tracked only for this duration.

This option is applicable when :emphasis:`job\_wait` is :literal:`true`.


resource_id (optional, str, None)
Manager ID of the iDRAC.


idrac_ip (True, str, None)
iDRAC IP Address.


idrac_user (False, str, None)
iDRAC username.

If the username is not provided, then the environment variable :envvar:`IDRAC\_USERNAME` is used.

Example: export IDRAC\_USERNAME=username


idrac_password (False, str, None)
iDRAC user password.

If the password is not provided, then the environment variable :envvar:`IDRAC\_PASSWORD` is used.

Example: export IDRAC\_PASSWORD=password


x_auth_token (False, str, None)
Authentication token.

If the x\_auth\_token is not provided, then the environment variable :envvar:`IDRAC\_X\_AUTH\_TOKEN` is used.

Example: export IDRAC\_X\_AUTH\_TOKEN=x\_auth\_token


idrac_port (optional, int, 443)
iDRAC port.


validate_certs (optional, bool, True)
If :literal:`false`\ , the SSL certificates will not be validated.

Configure :literal:`false` only on personally controlled sites where self-signed certificates are used.

Prior to collection version :literal:`5.0.0`\ , the :emphasis:`validate\_certs` is :literal:`false` by default.


ca_path (optional, path, None)
The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.


timeout (optional, int, 30)
The socket level timeout in seconds.





Notes
-----

.. note::
- Run this module from a system that has direct access to Dell iDRAC.
- This module supports only iDRAC9 and above.
- This module supports IPv4 and IPv6 addresses.




Examples
--------

.. code-block:: yaml+jinja


---
- name: Erase a single component and power on the server
dellemc.openmanage.idrac_system_erase:
idrac_ip: 198.162.0.1
idrac_user: username
idrac_password: passw0rd
ca_path: "/path/to/ca_cert.pem"
component: ["BIOS"]
power_on: true

- name: Erase multiple components and do not power on the server after the erase operation is completed
dellemc.openmanage.idrac_system_erase:
idrac_ip: 198.162.0.1
idrac_user: username
idrac_password: passw0rd
ca_path: "/path/to/ca_cert.pem"
component: ["BIOS", "DIAG", "PERCNVCache"]

- name: Erase multiple components and do not wait for the job completion
dellemc.openmanage.idrac_system_erase:
idrac_ip: 198.162.0.1
idrac_user: username
idrac_password: passw0rd
ca_path: "/path/to/ca_cert.pem"
component: ["IDRAC", "DPU", "LCData"]
job_wait: false



Return Values
-------------

msg (always, str, Successfully completed the system erase operation.)
Status of the component system erase operation.


job_details (For system erase operation, dict, {'ActualRunningStartTime': None, 'ActualRunningStopTime': None, 'CompletionTime': '2024-08-06T19:55:01', 'Description': 'Job Instance', 'EndTime': 'TIME_NA', 'Id': 'JID_229917427823', 'JobState': 'Completed', 'JobType': 'SystemErase', 'Message': 'Job completed successfully.', 'MessageArgs': [], '[email protected]': 0, 'MessageId': 'SYS018', 'Name': 'System_Erase', 'PercentComplete': 100, 'StartTime': '2024-08-06T19:49:02', 'TargetSettingsURI': None})
Returns the output for status of the job.


error_info (On HTTP error, dict, {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the operation because the value NonVolatileMemor entered for the property Component is not in the list of acceptable values.', 'MessageArgs': ['NonVolatileMemor', 'Component'], '[email protected]': 2, 'MessageId': 'IDRAC.2.9.SYS426', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': "Enter a valid value from the enumeration list that Redfish service supports and retry the operation.For information about valid values, see the iDRAC User's Guide available on the support site.", 'Severity': 'Warning'}, {'Message': "The value 'NonVolatileMemor' for the property Component is not in the list of acceptable values.", 'MessageArgs': ['NonVolatileMemor', 'Component'], '[email protected]': 2, 'MessageId': 'Base.1.12.PropertyValueNotInList', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed.', 'Severity': 'Warning'}], 'code': 'Base.1.12.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information'}})
Details of the HTTP Error.





Status
------





Authors
~~~~~~~

- Rajshekar P(@rajshekarp87)

1 change: 1 addition & 0 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Here are the list of modules and module_utils supported by Dell.
├── idrac_storage_volume.py
├── idrac_support_assist.py
├── idrac_syslog.py
├── idrac_system_erase.py
├── idrac_system_info.py
├── idrac_timezone_ntp.py
├── idrac_user.py
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/idrac_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@
ignore_certificate_warning:
description:
- Ignores the certificate warning while connecting to Share and is only applicable when I(share_type) is C(https).
- C(off) ignores the certificate warning.
- C(on) does not ignore the certificate warning.
- C(on) ignores the certificate warning.
- C(off) does not ignore the certificate warning.
type: str
choices: ["off", "on"]
default: "off"
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/idrac_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
ignore_certificate_warning:
description:
- Ignores the certificate warning while connecting to Share and is only applicable when I(share_type) is C(https).
- C(off) ignores the certificate warning.
- C(on) does not ignore the certificate warning.
- C(on) ignores the certificate warning.
- C(off) does not ignore the certificate warning.
type: str
choices: ["off", "on"]
default: "off"
Expand Down
Loading

0 comments on commit 2c5ad3f

Please sign in to comment.