summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/openmanage/roles/idrac_bios
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
commit38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch)
tree356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/dellemc/openmanage/roles/idrac_bios
parentAdding upstream version 7.7.0+dfsg. (diff)
downloadansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz
ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/dellemc/openmanage/roles/idrac_bios')
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/README.md368
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/defaults/main.yml10
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/handlers/main.yml2
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/argument_specs.yml122
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/main.yml25
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/__get_data.yml16
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/converge.yml39
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/molecule.yml1
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml62
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/converge.yml135
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/molecule.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/converge.yml159
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/molecule.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/converge.yml32
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/molecule.yml7
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/converge.yml35
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/molecule.yml7
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/cleanup.yml17
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/prepare.yml30
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/converge.yml54
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/molecule.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/converge.yml60
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/molecule.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/converge.yml50
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/molecule.yml14
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/converge.yml74
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/molecule.yml14
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/converge.yml74
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/molecule.yml14
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/tasks/main.yml67
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/inventory2
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/test.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/vars/main.yml7
33 files changed, 1527 insertions, 0 deletions
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/README.md b/ansible_collections/dellemc/openmanage/roles/idrac_bios/README.md
new file mode 100644
index 000000000..25f439dc2
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/README.md
@@ -0,0 +1,368 @@
+# idrac_bios
+
+This role allows to modify BIOS attributes, clear pending BIOS attributes, and reset the BIOS to default settings.
+
+## Requirements
+
+---
+
+Requirements to develop and contribute to the role.
+
+### Development
+
+```text
+ansible
+docker
+molecule
+python
+```
+
+### Production
+
+Requirements to use the role.
+
+```text
+ansible
+python
+```
+
+## Ansible collections
+
+Collections required to use the role.
+
+```text
+dellemc.openmanage
+```
+
+## Role Variables
+
+---
+
+<table>
+<thead>
+ <tr>
+ <th>Name</th>
+ <th>Required</th>
+ <th>Default Value</th>
+ <th>Choices</th>
+ <th>Type</th>
+ <th>Description</th>
+ </tr>
+</thead>
+<tbody>
+ <tr>
+ <td>hostname</td>
+ <td>true</td>
+ <td></td>
+ <td></td>
+ <td>str</td>
+ <td>iDRAC IP Address</td>
+ </tr>
+ <tr>
+ <td>username</td>
+ <td>true</td>
+ <td></td>
+ <td></td>
+ <td>str</td>
+ <td>iDRAC username</td>
+ </tr>
+ <tr>
+ <td>password</td>
+ <td>true</td>
+ <td></td>
+ <td></td>
+ <td>str</td>
+ <td>iDRAC user password</td>
+ </tr>
+ <tr>
+ <td>https_port</td>
+ <td>false</td>
+ <td>443</td>
+ <td></td>
+ <td>int</td>
+ <td>iDRAC port</td>
+ </tr>
+ <tr>
+ <td>validate_certs</td>
+ <td>false</td>
+ <td>true</td>
+ <td></td>
+ <td>bool</td>
+ <td>
+ - If C(false), the SSL certificates will not be validated. <br>
+ - Configure C(false) only on personally controlled sites where self-signed certificates are used
+ </td>
+ </tr>
+ <tr>
+ <td>ca_path</td>
+ <td>false</td>
+ <td></td>
+ <td></td>
+ <td>path</td>
+ <td>
+ - The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.
+ </td>
+ </tr>
+ <tr>
+ <td>https_timeout</td>
+ <td>false</td>
+ <td>30</td>
+ <td></td>
+ <td>int</td>
+ <td>The socket level timeout in seconds.</td>
+ </tr>
+ <tr>
+ <td>attributes</td>
+ <td>false</td>
+ <td></td>
+ <td></td>
+ <td>dict</td>
+ <td>
+ - "Dictionary of BIOS attributes and value pair. Attributes should be part of the Redfish Dell BIOS Attribute Registry. Use U(https://I(idrac_ip)/redfish/v1/Systems/System.Embedded.1/Bios) to view the Redfish URI." <br>
+ - This is mutually exclusive with I(reset_bios).
+ </td>
+ </tr>
+ <tr>
+ <td>apply_time</td>
+ <td>false</td>
+ <td>Immediate</td>
+ <td>Immediate, OnReset, AtMaintenanceWindowStart, InMaintenanceWindowOnReset</td>
+ <td>str</td>
+ <td>
+ - Apply time of the I(attributes). <br>
+ - This is applicable only to I(attributes). <br>
+ - C(Immediate) Allows the user to immediately reboot the host and apply the changes.
+ I(job_wait) is applicable. <br>
+ - C(OnReset) Allows the user to apply the changes on the next reboot of the host server. <br>
+ - C(AtMaintenanceWindowStart) Allows the user to apply the changes at the start of a maintenance window as specifiedin
+ I(maintenance_window). A reboot job will be scheduled. <br>
+ - C(InMaintenanceWindowOnReset) Allows to apply the changes after a manual reset but within the maintenance window as specified in
+ I(maintenance_window).
+ </td>
+ </tr>
+ <tr>
+ <td>maintenance_window</td>
+ <td>false</td>
+ <td></td>
+ <td></td>
+ <td>dict</td>
+ <td>
+ - Option to schedule the maintenance window. <br>
+ - This is required when I(apply_time) is C(AtMaintenanceWindowStart) or
+ C(InMaintenanceWindowOnReset).
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start_time</td>
+ <td>true</td>
+ <td></td>
+ <td></td>
+ <td>str</td>
+ <td>
+ - The start time for the maintenance window to be scheduled. <br>
+ - The format is YYYY-MM-DDThh:mm:ss<offset>, <offset> is the time offset from UTC that
+ the current time zone set in iDRAC in the format: +05:30 for IST.
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;duration</td>
+ <td>true</td>
+ <td></td>
+ <td></td>
+ <td>int</td>
+ <td>
+ - The duration in seconds for the maintenance window. <br>
+ </td>
+ </tr>
+ <tr>
+ <td>clear_pending</td>
+ <td>false</td>
+ <td></td>
+ <td></td>
+ <td>bool</td>
+ <td>
+ - Allows the user to clear all pending BIOS attributes changes. <br>
+ - C(true) discards any pending changes to BIOS attributes or removes the job if in
+ scheduled state. <br>
+ - This operation will not create any job. <br>
+ - C(false) does not perform any operation. <br>
+ - This is mutually exclusive with I(reset_bios). <br>
+ - C(Note) Any BIOS job scheduled will not be cleared because of boot sources configuration. <br>
+ </td>
+</tr>
+ <tr>
+ <td>reset_bios</td>
+ <td>false</td>
+ <td></td>
+ <td></td>
+ <td>bool</td>
+ <td>
+ - Resets the BIOS to default settings and triggers a reboot of host system. <br>
+ - This is applied to the host after the restart. <br>
+ - This operation will not create any job. <br>
+ - C(false) does not perform any operation. <br>
+ - This is mutually exclusive with I(attributes), and I(clear_pending). <br>
+ - When C(true), this action will always report as changes found to be applicable.
+ </td>
+ </tr>
+ <tr>
+ <td>reset_type</td>
+ <td>false</td>
+ <td>graceful_restart</td>
+ <td>graceful_restart <br> force_restart</td>
+ <td>str</td>
+ <td>
+ - C(force_restart) Forcefully reboot the host system. <br>
+ - C(graceful_restart) Gracefully reboot the host system. <br>
+ - This is applicable for I(reset_bios), and I(attributes) when I(apply_time) is
+ C(Immediate).
+ </td>
+ </tr>
+ <tr>
+ <td>job_wait</td>
+ <td>false</td>
+ <td>true</td>
+ <td></td>
+ <td>bool</td>
+ <td>
+ - Provides the option to wait for job completion. <br>
+ - This is applicable for I(attributes) when I(apply_time) is C(Immediate). <br>
+ </td>
+ </tr>
+ <tr>
+ <td>job_wait_timeout</td>
+ <td>false</td>
+ <td>1200</td>
+ <td></td>
+ <td>int</td>
+ <td>
+ - The maximum wait time of I(job_wait) in seconds. <br>
+ The job is tracked only for this duration. <br>
+ - This option is applicable when I(job_wait) is C(True). <br>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+## Fact variables
+
+<table>
+<thead>
+ <tr>
+ <th>Name</th>
+ <th>Sample</th>
+ <th>Description</th>
+ </tr>
+</thead>
+ <tbody>
+ <tr>
+ <td>idrac_bios_out</td>
+ <td>{
+ "attributes": {
+ "ansible_facts": {},
+ "changed": true,
+ "failed": false,
+ "job_id": "JID_XXXXXXXXXXXX",
+ "msg": {
+ "ActualRunningStartTime": "2023-05-19T04:55:01",
+ "ActualRunningStopTime": "2023-05-19T04:59:21",
+ "CompletionTime": "2023-05-19T04:59:21",
+ "Description": "Job Instance",
+ "EndTime": "TIME_NA",
+ "Id": "JID_844899049402",
+ "JobState": "Completed",
+ "JobType": "BIOSConfiguration",
+ "Message": "Job completed successfully.",
+ "MessageArgs": [],
+ "MessageId": "PR19",
+ "Name": "Configure: BIOS.Setup.1-1",
+ "PercentComplete": 100,
+ "StartTime": "2023-05-19T04:51:44",
+ "TargetSettingsURI": null
+ },
+ "status_msg": "Successfully applied the BIOS attributes update."
+ },
+ "clear_pending": {
+ "changed": false,
+ "skip_reason": "Conditional result was False",
+ "skipped": true
+ },
+ "reset_bios": {
+ "changed": false,
+ "skip_reason": "Conditional result was False",
+ "skipped": true
+ }
+}</td>
+ <td>Module output of the idrac_bios job.</td>
+ </tr>
+ </tbody>
+</table>
+
+## Examples
+
+---
+
+```yaml
+- name: Configure generic attributes of the BIOS
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "192.168.0.1"
+ username: "user_name"
+ password: "user_password"
+ ca_path: "/path/to/ca_cert.pem"
+ attributes:
+ BootMode : "Bios"
+ OneTimeBootMode: "Enabled"
+ BootSeqRetry: "Enabled"
+```
+
+```yaml
+- name: Configure BIOS attributes at Maintenance window.
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "192.168.0.1"
+ username: "user_name"
+ password: "user_password"
+ ca_path: "/path/to/ca_cert.pem"
+ apply_time: AtMaintenanceWindowStart
+ maintenance_window:
+ start_time: "2022-09-30T05:15:40-05:00"
+ duration: 600
+ attributes:
+ BootMode : "Bios"
+ OneTimeBootMode: "Enabled"
+ BootSeqRetry: "Enabled"
+```
+
+```yaml
+- name: Clear pending BIOS attributes.
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "192.168.0.1"
+ username: "user_name"
+ password: "user_password"
+ ca_path: "/path/to/ca_cert.pem"
+ clear_pending: true
+```
+
+```yaml
+- name: Reset BIOS attributes to default settings.
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "192.168.0.1"
+ username: "user_name"
+ password: "user_password"
+ ca_path: "/path/to/ca_cert.pem"
+ reset_bios: true
+```
+
+## Author Information
+
+---
+
+Dell Technologies <br>
+Abhishek Sinha (Abhishek.Sinha10@Dell.com) 2023
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/defaults/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/defaults/main.yml
new file mode 100644
index 000000000..6b146abc8
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/defaults/main.yml
@@ -0,0 +1,10 @@
+---
+# defaults file for idrac_bios
+https_port: 443
+validate_certs: true
+https_timeout: 30
+apply_time: "Immediate"
+clear_pending: false
+reset_type: "graceful_restart"
+job_wait: true
+job_wait_timeout: 1200
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/handlers/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/handlers/main.yml
new file mode 100644
index 000000000..7cbf8c33d
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/handlers/main.yml
@@ -0,0 +1,2 @@
+---
+# handlers file for idrac_bios
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/argument_specs.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/argument_specs.yml
new file mode 100644
index 000000000..febdd96ca
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/argument_specs.yml
@@ -0,0 +1,122 @@
+---
+argument_specs:
+ main:
+ version_added: "7.6.0"
+ short_description: Modify and clear BIOS attributes, and reset BIOS settings
+ description:
+ - This role allows to modify BIOS attributes, clear pending BIOS attributes, and reset the BIOS to default settings.
+ options:
+ hostname:
+ required: true
+ type: str
+ description:
+ - iDRAC IP Address.
+ username:
+ type: str
+ description:
+ - iDRAC username.
+ password:
+ type: str
+ description:
+ - iDRAC user password.
+ https_port:
+ type: int
+ description:
+ - iDRAC port.
+ default: 443
+ validate_certs:
+ description:
+ - If C(false), the SSL certificates will not be validated.
+ - Configure C(false) only on personally controlled sites where self-signed certificates are used.
+ type: bool
+ default: true
+ ca_path:
+ description:
+ - The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.
+ type: path
+ https_timeout:
+ description:
+ - The socket level timeout in seconds.
+ type: int
+ default: 30
+ attributes:
+ type: dict
+ description:
+ - Dictionary of BIOS attributes and value pair.
+ Attributes should be part of the Redfish Dell BIOS Attribute Registry.
+ Use idrac_gather_facts role to fetch the BIOS attributes.
+ - This is mutually exclusive with I(reset_bios).
+ apply_time:
+ description:
+ - 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). A reboot job will be scheduled.
+ - C(InMaintenanceWindowOnReset) Allows to apply the changes after a manual reset but within the maintenance window as specified in
+ I(maintenance_window).
+ choices:
+ [
+ Immediate,
+ OnReset,
+ AtMaintenanceWindowStart,
+ InMaintenanceWindowOnReset,
+ ]
+ default: Immediate
+ maintenance_window:
+ type: dict
+ description:
+ - Option to schedule the maintenance window.
+ - This is required when I(apply_time) is C(AtMaintenanceWindowStart) or C(InMaintenanceWindowOnReset).
+ options:
+ start_time:
+ type: str
+ description:
+ - The start time for the maintenance window to be scheduled.
+ - "The format is YYYY-MM-DDThh:mm:ss<offset>"
+ - "<offset> is the time offset from UTC that the current time zone set in iDRAC in the format: +05:30 for IST."
+ required: true
+ duration:
+ type: int
+ description:
+ - The duration in seconds for the maintenance window.
+ required: true
+ clear_pending:
+ type: bool
+ description:
+ - Allows the user to clear all pending BIOS attributes changes.
+ - C(true) discards any pending changes to BIOS attributes or removes the job if in scheduled state.
+ - This operation will not create any job.
+ - C(false) does not perform any operation.
+ - This is mutually exclusive with I(boot_sources), I(attributes), and I(reset_bios).
+ - C(Note) Any BIOS job scheduled will not be cleared because of boot sources configuration.
+ reset_bios:
+ type: bool
+ description:
+ - Resets the BIOS to default settings and triggers a reboot of host system.
+ - This is applied to the host after the restart.
+ - This operation will not create any job.
+ - C(false) does not perform any operation.
+ - This is mutually exclusive with I(boot_sources), I(attributes), and I(clear_pending).
+ - When C(true), this action will always report as changes found to be applicable.
+ reset_type:
+ type: str
+ description:
+ - C(force_restart) Forcefully reboot the host system.
+ - C(graceful_restart) Gracefully reboot the host system.
+ - This is applicable for I(reset_bios), and I(attributes) when I(apply_time) is C(Immediate).
+ choices: [graceful_restart, force_restart]
+ default: graceful_restart
+ job_wait:
+ type: bool
+ description:
+ - Provides the option to wait for job completion.
+ - This is applicable for I(attributes) when I(apply_time) is C(Immediate).
+ default: true
+ job_wait_timeout:
+ type: int
+ description:
+ - The maximum wait time of I(job_wait) in seconds. The job is tracked only for this duration.
+ - This option is applicable when I(job_wait) is C(true).
+ default: 1200
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/main.yml
new file mode 100644
index 000000000..e660452c3
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/meta/main.yml
@@ -0,0 +1,25 @@
+galaxy_info:
+ author: Abhishek Sinha ('Abhishek-Dell')
+ description: The role performs idrac bios operations.
+ company: Dell Technologies
+
+ license: GPL-3.0-only
+
+ min_ansible_version: '2.13'
+
+ platforms:
+ - name: EL
+ versions:
+ - "9"
+ - "8"
+ - name: Ubuntu
+ versions:
+ - jammy
+ - name: SLES
+ versions:
+ - "15SP3"
+ - "15SP4"
+
+ galaxy_tags: []
+
+dependencies: []
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/__get_data.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/__get_data.yml
new file mode 100644
index 000000000..a7ee9c67e
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/__get_data.yml
@@ -0,0 +1,16 @@
+---
+- name: Get uri data
+ ansible.builtin.uri:
+ url: "{{ url }}"
+ user: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ body: {}
+ body_format: json
+ force_basic_auth: true
+ return_content: true
+ status_code: 200
+ headers: 'Accept=application/json'
+ check_mode: false
+ no_log: true
+ register: idrac_bios_uri_data
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/converge.yml
new file mode 100644
index 000000000..d81646ccb
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/converge.yml
@@ -0,0 +1,39 @@
+---
+- name: Converge file for clear pending attributes
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Clear pending attributes
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ clear_pending: true
+
+ - name: Verify clear pending attributes in normal mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.clear_pending.status_msg == "Successfully cleared
+ the pending BIOS attributes."
+ - idrac_bios_out.reset_bios.skipped
+ - idrac_bios_out.attributes.skipped
+ when: not ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Verify clear pending attributes in check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.clear_pending.status_msg == "Changes found
+ to be applied."
+ when: ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Verify clear pending attributes in idempotence mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.clear_pending.status_msg == "No changes found
+ to be applied."
+ when: not ansible_check_mode and not idrac_bios_out.clear_pending.changed
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/molecule.yml
new file mode 100644
index 000000000..ed97d539c
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/molecule.yml
@@ -0,0 +1 @@
+---
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml
new file mode 100644
index 000000000..46d74222a
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml
@@ -0,0 +1,62 @@
+---
+- name: Converge file to update attributes with apply time as Immediate
+ hosts: all
+ gather_facts: false
+ vars:
+ idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
+ idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
+ tasks:
+ - name: Fetch Jobs Data
+ ansible.builtin.include_tasks:
+ file: ../__get_data.yml
+ vars:
+ url: "https://{{ idrac_ip }}:{{ idrac_port }}/redfish/v1/Managers\
+ /iDRAC.Embedded.1/Jobs?$expand=*($levels=1)"
+
+ - name: Fetch Bios Jobs Data
+ when: idrac_bios_uri_data.json.Members | length > 0
+ ansible.builtin.set_fact:
+ idrac_bios_jobs_items: "{{ idrac_bios_uri_data.json.Members
+ | json_query(query) }}"
+ vars:
+ query: "[?JobType=='BIOSConfiguration' && JobState=='Scheduled'
+ || JobState=='Scheduling' ]"
+ no_log: true
+
+ - name: Block for creating a bios job as a pre-requisite
+ when: idrac_bios_jobs_items | length == 0
+ block:
+ - name: Fetch IDRAC Data
+ ansible.builtin.include_tasks:
+ file: ../__get_data.yml
+ vars:
+ url: "https://{{ idrac_ip }}:{{ idrac_port }}/redfish/v1/\
+ Systems/System.Embedded.1/Bios"
+
+ - name: Fetch the existing boot mode
+ ansible.builtin.set_fact:
+ boot_mode: "{{ idrac_bios_uri_data.json.Attributes.BootMode }}"
+
+ - name: Set the boot mode
+ ansible.builtin.set_fact:
+ set_boot_mode: "{{ 'Bios' if (boot_mode == 'Uefi') else 'Uefi' }}"
+ when: set_boot_mode is not defined
+
+ - name: Update attributes with apply time as Immediate
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ idrac_ip }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: "OnReset"
+ attributes:
+ BootMode: "{{ set_boot_mode }}"
+ register: idrac_bios_change_bios_setting
+
+ - name: Verify job is scheduled
+ ansible.builtin.assert:
+ that:
+ - "'Successfully committed changes. The job is in pending state'
+ in idrac_bios_out.attributes.status_msg"
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/converge.yml
new file mode 100644
index 000000000..6f8488153
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/converge.yml
@@ -0,0 +1,135 @@
+---
+- name: Converge file for negative scenarios
+ hosts: all
+ gather_facts: false
+ tasks:
+ ########## Below snippet is commented because of Issue: JIT-285533 ########
+ # - name: Perform reset bios with invalid hostname
+ # ansible.builtin.import_role:
+ # name: idrac_bios
+ # vars:
+ # hostname: "randomHostname"
+ # username: "{{ lookup('env', 'IDRAC_USER') }}"
+ # password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ # validate_certs: false
+ # reset_bios: true
+ # ignore_unreachable: true
+
+ # - name: Assert reset bios with invalid hostname
+ # ansible.builtin.assert:
+ # that:
+ # - "'Unable to communicate with iDRAC randomHostname' in
+ # idrac_bios_out.reset_bios.msg"
+ ###########################################################################
+
+ - name: Block to reset bios with invalid username
+ block:
+ - name: Perform reset bios with invalid username
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "randomusername"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ reset_bios: true
+ clear_pending: false
+ rescue:
+ - name: Verify reset bios with invalid username
+ ansible.builtin.assert:
+ that:
+ - "'HTTP Error 401' in ansible_failed_result.msg"
+
+ - name: Block for clear pending attributes with invalid value
+ block:
+ - name: Clear pending attributes with invalid value
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ clear_pending: yess
+ rescue:
+ - name: Assert clear pending attributes with invalid value
+ ansible.builtin.assert:
+ that: ansible_failed_result.msg is
+ search('unable to convert to bool')
+
+ - name: Block for reset bios with invalid value
+ block:
+ - name: Perform reset bios with invalid value
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ reset_bios: truee
+ rescue:
+ - name: Assert perform reset bios with invalid value
+ ansible.builtin.assert:
+ that: ansible_failed_result.msg is
+ search('unable to convert to bool')
+
+ - name: Block for reset bios with invalid password
+ block:
+ - name: Perform reset bios with invalid password
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "randompassword"
+ validate_certs: false
+ clear_pending: false
+ reset_bios: true
+ rescue:
+ - name: Assert reset bios with invalid password
+ ansible.builtin.assert:
+ that: |-
+ ("'HTTP Error 401' in ansible_failed_result.msg")
+ or
+ ("'urlopen error timed out' in ansible_failed_result.msg")
+
+ - name: Block for reset type with invalid value
+ block:
+ - name: Perform reset type with invalid value
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ clear_pending: false
+ reset_bios: true
+ reset_type: graceful_restartt
+ rescue:
+ - name: Assert reset type with invalid value
+ ansible.builtin.assert:
+ that:
+ - ansible_failed_result.msg is
+ search('value of reset_type must be one of')
+ - ansible_failed_result.msg is
+ search('graceful_restart, force_restart')
+
+ - name: Clear pending attributes with reset
+ block:
+ - name: Clear pending attributes with reset
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ clear_pending: true
+ reset_bios: true
+ rescue:
+ - name: Assert clear pending attributes with reset
+ ansible.builtin.assert:
+ that: "ansible_failed_result.msg is
+ search('clear_pending and reset_bios is mutually exclusive')"
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/molecule.yml
new file mode 100644
index 000000000..210914970
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+scenario:
+ test_sequence:
+ - create
+ - converge
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/converge.yml
new file mode 100644
index 000000000..44439ab07
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/converge.yml
@@ -0,0 +1,159 @@
+---
+- name: Converge file for negative scenarios with maintenance window
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Block to update attributes with maintenance window and no start_time
+ block:
+ - name: Update attributes with maintenance window and no start_time
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: AtMaintenanceWindowStart
+ maintenance_window:
+ duration: 600
+ attributes:
+ BootMode: "Bios"
+ rescue:
+ - name: Assert update attributes with maintenance window
+ and no start_time
+ ansible.builtin.assert:
+ that: "ansible_failed_result.msg is
+ search('missing required arguments')"
+
+ - name: Block to update attributes with maintenance window
+ with invalid start_time
+ block:
+ - name: Update attributes with maintenance window with
+ invalid start_time
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: AtMaintenanceWindowStart
+ maintenance_window:
+ start_time: "2022"
+ duration: 600
+ attributes:
+ BootMode: "Bios"
+ rescue:
+ - name: Assert update attributes with maintenance window
+ with invalid start_time
+ ansible.builtin.assert:
+ that: "idrac_bios_out.attributes.status_msg is search('The
+ maintenance time must be post-fixed with local offset
+ to -06:00.')"
+
+ - name: Block to update attributes with maintenance window
+ with invalid duration
+ block:
+ - name: Update attributes with maintenance window with invalid duration
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: AtMaintenanceWindowStart
+ maintenance_window:
+ start_time: "2022-30-09T05:15:40-21"
+ duration: "10 minutes"
+ attributes:
+ BootMode: "Bios"
+ rescue:
+ - name: Assert update attributes with maintenance window
+ with invalid duration
+ ansible.builtin.assert:
+ that:
+ - "ansible_failed_result.msg is
+ search('Validation of arguments failed')"
+
+ - name: Block to update attributes with maintenance window
+ with invalid apply time
+ block:
+ - name: Update attributes with maintenance window
+ with invalid apply time
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: AtMaintenanceWindowBegin
+ maintenance_window:
+ start_time: "2022-30-09T05:15:40-21"
+ duration: 10
+ attributes:
+ BootMode: "Bios"
+ rescue:
+ - name: Assert update attributes with maintenance window
+ with invalid apply time
+ ansible.builtin.assert:
+ that:
+ - "ansible_failed_result.msg is search('value of
+ apply_time must be one of')"
+ - "ansible_failed_result.msg is search('Immediate,
+ OnReset, AtMaintenanceWindowStart, InMaintenanceWindowOnReset')"
+
+ - name: Block to update attributes with maintenance
+ window with invalid job wait
+ block:
+ - name: Update attributes with maintenance window with invalid job wait
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: AtMaintenanceWindowStart
+ maintenance_window:
+ start_time: "2023-05-18T05:17:40-05:00"
+ duration: 600
+ attributes:
+ BootMode: "Bios"
+ job_wait: truee
+ rescue:
+ - name: Assert update attributes with maintenance
+ window with invalid job wait
+ ansible.builtin.assert:
+ that: "ansible_failed_result.msg is
+ search('unable to convert to bool')"
+
+ - name: Block to update attributes with maintenance window
+ with invalid job wait timeout
+ block:
+ - name: Update attributes with maintenance window
+ with invalid job wait timeout
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: AtMaintenanceWindowStart
+ maintenance_window:
+ start_time: "2023-05-18T05:17:40-05:00"
+ duration: 600
+ attributes:
+ BootMode: "Bios"
+ OneTimeBootMode: "Enabled"
+ BootSeqRetry: "Enabled"
+ job_wait_timeout: -10
+ rescue:
+ - name: Assert attributes with maintenance window
+ with invalid job wait timeout
+ ansible.builtin.assert:
+ that:
+ - "'The parameter job_wait_timeout value cannot
+ be negative or zero' in idrac_bios_out.attributes.msg"
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/molecule.yml
new file mode 100644
index 000000000..210914970
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/negative_scenarios_with_maintenance_window/molecule.yml
@@ -0,0 +1,6 @@
+---
+scenario:
+ test_sequence:
+ - create
+ - converge
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/converge.yml
new file mode 100644
index 000000000..6c2e8098f
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/converge.yml
@@ -0,0 +1,32 @@
+---
+- name: Converge file for reset bios
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Perform reset bios operation
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ reset_bios: true
+
+ - name: Verify reset bios operation in normal mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.reset_bios.status_msg == "BIOS reset to defaults has
+ been completed successfully."
+ - idrac_bios_out.clear_pending.skipped
+ - idrac_bios_out.attributes.skipped
+ when: not ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Verify reset bios operation in check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.reset_bios.status_msg == "Changes found
+ to be applied."
+ when: ansible_check_mode
+ tags: molecule-idempotence-notest
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/molecule.yml
new file mode 100644
index 000000000..608be28b1
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios/molecule.yml
@@ -0,0 +1,7 @@
+---
+scenario:
+ test_sequence:
+ - create
+ - check
+ - converge
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/converge.yml
new file mode 100644
index 000000000..03b93a73f
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/converge.yml
@@ -0,0 +1,35 @@
+---
+- name: Converge file for reset type as force restart
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Perform reset operation with reset type as force restart
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ reset_bios: true
+ reset_type: force_restart
+
+ - name: Verify reset bios operation with reset type as force
+ restart in normal mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.reset_bios.status_msg == "BIOS reset to defaults
+ has been completed successfully."
+ - idrac_bios_out.clear_pending.skipped
+ - idrac_bios_out.attributes.skipped
+ when: not ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Verify reset bios operation with reset type as force restart
+ in check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.reset_bios.status_msg == "Changes found to
+ be applied."
+ when: ansible_check_mode
+ tags: molecule-idempotence-notest
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/molecule.yml
new file mode 100644
index 000000000..608be28b1
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/reset_bios_with_reset_type_as_force_restart/molecule.yml
@@ -0,0 +1,7 @@
+---
+scenario:
+ test_sequence:
+ - create
+ - check
+ - converge
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/cleanup.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/cleanup.yml
new file mode 100644
index 000000000..a107545a8
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/cleanup.yml
@@ -0,0 +1,17 @@
+---
+- name: CleanUp file for update attributes with apply time as Immediate
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Checking file exists- boot_mode.txt
+ ansible.builtin.stat:
+ path: "/tmp/boot_mode.txt"
+ delegate_to: localhost
+ register: boot_mode_file
+
+ - name: Deleting the file if exists
+ ansible.builtin.file:
+ path: "/tmp/boot_mode.txt"
+ state: absent
+ delegate_to: localhost
+ when: boot_mode_file.stat.exists
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/prepare.yml
new file mode 100644
index 000000000..a8bf8042b
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/resources/prepare.yml
@@ -0,0 +1,30 @@
+---
+- name: Prepare file to update attributes with apply time as Immediate
+ hosts: all
+ gather_facts: false
+ vars:
+ idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
+ idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
+ tasks:
+ - name: Fetch IDRAC Data
+ ansible.builtin.include_tasks:
+ file: ../__get_data.yml
+ vars:
+ url: "https://{{ idrac_ip }}:{{ idrac_port }}/redfish/v1/\
+ Systems/System.Embedded.1/Bios"
+
+ - name: Fetch the existing boot mode
+ ansible.builtin.set_fact:
+ boot_mode: "{{ idrac_bios_uri_data.json.Attributes.BootMode }}"
+
+ - name: Set the boot mode
+ ansible.builtin.set_fact:
+ set_boot_mode: "{{ 'Bios' if (boot_mode == 'Uefi') else 'Uefi' }}"
+ when: set_boot_mode is not defined
+
+ - name: Copy the variable 'set_boot_mode' in file
+ ansible.builtin.copy:
+ content: "{{ set_boot_mode }}"
+ dest: "/tmp/boot_mode.txt"
+ mode: "0755"
+ delegate_to: localhost
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/converge.yml
new file mode 100644
index 000000000..9c247b7a1
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/converge.yml
@@ -0,0 +1,54 @@
+---
+- name: Converge file to update attributes with apply time as Immediate
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Read file content for set_boot_mode variable
+ ansible.builtin.command: cat /tmp/boot_mode.txt
+ register: file_content
+ check_mode: false
+ delegate_to: localhost
+ changed_when: true
+
+ - name: Set set_boot_mode variable
+ ansible.builtin.set_fact:
+ set_boot_mode: "{{ file_content.stdout }}"
+ delegate_to: localhost
+
+ - name: Update attributes with apply time as Immediate
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: Immediate
+ attributes:
+ BootMode: "{{ set_boot_mode }}"
+
+ - name: Assert update attributes with apply time as Immediate - normal mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Successfully applied the
+ BIOS attributes update."
+ - idrac_bios_out.reset_bios.skipped
+ - idrac_bios_out.clear_pending.skipped
+ when: not ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Assert update attributes with apply time as Immediate - check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Changes found to
+ be applied."
+ when: ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Assert update attributes with apply time as Immediate
+ in idempotence mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "No changes found
+ to be applied."
+ when: not ansible_check_mode and not idrac_bios_out.attributes.changed
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/molecule.yml
new file mode 100644
index 000000000..df2ebca6b
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ name: ansible
+ playbooks:
+ prepare: ../resources/prepare.yml
+ cleanup: ../resources/cleanup.yml
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/converge.yml
new file mode 100644
index 000000000..1800ce04f
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/converge.yml
@@ -0,0 +1,60 @@
+---
+- name: Converge file to update attributes with
+ apply time as Immediate with job wait
+ hosts: all
+ gather_facts: false
+ vars:
+ idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
+ idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
+ tasks:
+ - name: Read file content for set_boot_mode variable
+ ansible.builtin.command: cat /tmp/boot_mode.txt
+ register: file_content
+ check_mode: false
+ delegate_to: localhost
+ changed_when: true
+
+ - name: Set set_boot_mode variable
+ ansible.builtin.set_fact:
+ set_boot_mode: "{{ file_content.stdout }}"
+ delegate_to: localhost
+
+ - name: Update attributes with apply time as Immediate with job wait
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: Immediate
+ attributes:
+ BootMode: "{{ set_boot_mode }}"
+ job_wait: true
+
+ - name: Assert update attributes with apply time as Immediate - normal mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Successfully
+ applied the BIOS attributes update."
+ - idrac_bios_out.reset_bios.skipped
+ - idrac_bios_out.clear_pending.skipped
+ when: not ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Assert update attributes with apply time as Immediate
+ in check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Changes found
+ to be applied."
+ when: ansible_check_mode
+ tags: molecule-idempotence-notest
+
+ - name: Assert update attributes with apply time as Immediate in
+ idempotence mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "No changes found
+ to be applied."
+ when: not ansible_check_mode and not idrac_bios_out.attributes.changed
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/molecule.yml
new file mode 100644
index 000000000..df2ebca6b
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_immediate_with_jobwait/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ name: ansible
+ playbooks:
+ prepare: ../resources/prepare.yml
+ cleanup: ../resources/cleanup.yml
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/converge.yml
new file mode 100644
index 000000000..fb36db3b7
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/converge.yml
@@ -0,0 +1,50 @@
+---
+- name: Converge file for update attributes with apply time as reset
+ hosts: all
+ gather_facts: false
+ vars:
+ idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
+ idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
+ tasks:
+ - name: Read file content for set_boot_mode variable
+ ansible.builtin.command: cat /tmp/boot_mode.txt
+ register: file_content
+ check_mode: false
+ delegate_to: localhost
+ changed_when: true
+
+ - name: Set set_boot_mode variable
+ ansible.builtin.set_fact:
+ set_boot_mode: "{{ file_content.stdout }}"
+ delegate_to: localhost
+
+ - name: Update attributes with apply time as reset
+ ansible.builtin.include_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: OnReset
+ attributes:
+ BootMode: "{{ set_boot_mode }}"
+ job_wait: false
+
+ - name: Assert update attributes with apply time as reset in normal mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Successfully committed
+ changes. The job is in pending state. The changes will be
+ applied OnReset"
+ - idrac_bios_out.reset_bios.skipped
+ - idrac_bios_out.clear_pending.skipped
+
+ when: not ansible_check_mode
+
+ - name: Assert update attributes with apply time as reset in check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Changes found
+ to be applied."
+ when: ansible_check_mode
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/molecule.yml
new file mode 100644
index 000000000..d3bacf777
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset/molecule.yml
@@ -0,0 +1,14 @@
+---
+provisioner:
+ name: ansible
+ playbooks:
+ prepare: ../resources/prepare.yml
+ cleanup: ../resources/cleanup.yml
+scenario:
+ test_sequence:
+ - create
+ - prepare
+ - check
+ - converge
+ - cleanup
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/converge.yml
new file mode 100644
index 000000000..7ac8c1bad
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/converge.yml
@@ -0,0 +1,74 @@
+---
+- name: Converge file for update attributes with apply
+ time at reset of maintenance window
+ hosts: all
+ gather_facts: false
+ vars:
+ idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
+ idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
+ tasks:
+ - name: Read file content for set_boot_mode variable
+ ansible.builtin.command: cat /tmp/boot_mode.txt
+ register: file_content
+ check_mode: false
+ delegate_to: localhost
+ changed_when: true
+
+ - name: Set set_boot_mode variable
+ ansible.builtin.set_fact:
+ set_boot_mode: "{{ file_content.stdout }}"
+ delegate_to: localhost
+
+ - name: Get tomorrow's date
+ ansible.builtin.command: date -d "+1 day" +'%Y-%m-%dT%H:%M:%S'
+ register: tomorrow_date
+ changed_when: false
+
+ - name: Convert tomorrow's date to string
+ ansible.builtin.set_fact:
+ date_str: "{{ tomorrow_date.stdout }}"
+
+ - name: Fetch IDRAC time offset
+ ansible.builtin.include_tasks:
+ file: ../__get_data.yml
+ vars:
+ url: "https://{{ idrac_ip }}:{{ idrac_port }}/redfish/v1\
+ /Managers/iDRAC.Embedded.1"
+
+ - name: Set the local offset
+ when: idrac_bios_uri_data.json.DateTimeLocalOffset is defined
+ ansible.builtin.set_fact:
+ local_offset: "{{ idrac_bios_uri_data.json.DateTimeLocalOffset }}"
+
+ - name: Update attributes with apply time at reset of maintenance window
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: InMaintenanceWindowOnReset
+ maintenance_window:
+ start_time: "{{ date_str }}{{ local_offset }}"
+ duration: 600
+ attributes:
+ BootMode: "{{ set_boot_mode }}"
+
+ - name: Assert update attributes with apply time at reset
+ of maintenance window normal mode
+ ansible.builtin.assert:
+ that:
+ - "'Successfully committed changes. The job is in pending state'
+ in idrac_bios_out.attributes.status_msg"
+ - idrac_bios_out.reset_bios.skipped
+ - idrac_bios_out.clear_pending.skipped
+ when: not ansible_check_mode
+
+ - name: Assert Update attributes with apply time at reset of
+ maintenance window in check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Changes found to
+ be applied."
+ when: ansible_check_mode
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/molecule.yml
new file mode 100644
index 000000000..d3bacf777
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_on_reset_with_maintenance_window/molecule.yml
@@ -0,0 +1,14 @@
+---
+provisioner:
+ name: ansible
+ playbooks:
+ prepare: ../resources/prepare.yml
+ cleanup: ../resources/cleanup.yml
+scenario:
+ test_sequence:
+ - create
+ - prepare
+ - check
+ - converge
+ - cleanup
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/converge.yml
new file mode 100644
index 000000000..43004cea7
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/converge.yml
@@ -0,0 +1,74 @@
+---
+- name: Converge file to update attributes with apply time
+ at start of maintenance window
+ hosts: all
+ gather_facts: false
+ vars:
+ idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
+ idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
+ tasks:
+ - name: Read file content for set_boot_mode variable
+ ansible.builtin.command: cat /tmp/boot_mode.txt
+ register: file_content
+ check_mode: false
+ delegate_to: localhost
+ changed_when: true
+
+ - name: Set set_boot_mode variable
+ ansible.builtin.set_fact:
+ set_boot_mode: "{{ file_content.stdout }}"
+ delegate_to: localhost
+
+ - name: Get tomorrow's date
+ ansible.builtin.command: date -d "+1 day" +'%Y-%m-%dT%H:%M:%S'
+ register: tomorrow_date
+ changed_when: false
+
+ - name: Convert tomorrow's date to string
+ ansible.builtin.set_fact:
+ date_str: "{{ tomorrow_date.stdout }}"
+
+ - name: Fetch IDRAC time offset
+ ansible.builtin.include_tasks:
+ file: ../__get_data.yml
+ vars:
+ url: "https://{{ idrac_ip }}:{{ idrac_port }}/redfish/v1\
+ /Managers/iDRAC.Embedded.1"
+
+ - name: Set the local offset
+ when: idrac_bios_uri_data.json.DateTimeLocalOffset is defined
+ ansible.builtin.set_fact:
+ local_offset: "{{ idrac_bios_uri_data.json.DateTimeLocalOffset }}"
+
+ - name: Update attributes with apply time at start of maintenance window
+ ansible.builtin.import_role:
+ name: idrac_bios
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ apply_time: AtMaintenanceWindowStart
+ maintenance_window:
+ start_time: "{{ date_str }}{{ local_offset }}"
+ duration: 600
+ attributes:
+ BootMode: "{{ set_boot_mode }}"
+
+ - name: Assert update attributes with apply time at start of
+ maintenance window in normal mode
+ ansible.builtin.assert:
+ that:
+ - "'Successfully committed changes. The job is in pending state' in
+ idrac_bios_out.attributes.status_msg"
+ - idrac_bios_out.reset_bios.skipped
+ - idrac_bios_out.clear_pending.skipped
+ when: not ansible_check_mode
+
+ - name: Assert update attributes with apply time at start of
+ maintenance window in check mode
+ ansible.builtin.assert:
+ that:
+ - idrac_bios_out.attributes.status_msg == "Changes found to
+ be applied."
+ when: ansible_check_mode
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/molecule.yml
new file mode 100644
index 000000000..d3bacf777
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/update_attributes_with_maintenance_window/molecule.yml
@@ -0,0 +1,14 @@
+---
+provisioner:
+ name: ansible
+ playbooks:
+ prepare: ../resources/prepare.yml
+ cleanup: ../resources/cleanup.yml
+scenario:
+ test_sequence:
+ - create
+ - prepare
+ - check
+ - converge
+ - cleanup
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/tasks/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/tasks/main.yml
new file mode 100644
index 000000000..18567035c
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/tasks/main.yml
@@ -0,0 +1,67 @@
+---
+# tasks file for idrac_bios
+- name: Performing idrac_bios operation
+ block:
+ - name: Checking attributes/clear_pending and reset_bios is mutually exclusive
+ ansible.builtin.fail:
+ msg: "{{ idrac_bios_mutual_exclusive_msg }}"
+ when:
+ - (attributes is defined and (reset_bios is defined and reset_bios))
+ or
+ (clear_pending and (reset_bios is defined and reset_bios))
+
+ - name: Setting idrac_inputs
+ ansible.builtin.set_fact:
+ idrac_inputs: &idrac_inputs
+ idrac_ip: "{{ hostname }}"
+ idrac_port: "{{ https_port }}"
+ idrac_user: "{{ username }}"
+ idrac_password: "{{ password }}"
+ ca_path: "{{ ca_path | default(omit) }}"
+ validate_certs: "{{ validate_certs }}"
+ timeout: "{{ https_timeout }}"
+ job_wait: "{{ job_wait }}"
+ job_wait_timeout: "{{ job_wait_timeout }}"
+ no_log: true
+
+ - name: Performing clear pending operation
+ dellemc.openmanage.idrac_bios:
+ <<: *idrac_inputs
+ clear_pending: "{{ clear_pending }}"
+ register: idrac_bios_clear_pending_out
+ delegate_to: "{{ idrac_bios_delegate }}"
+ when: clear_pending
+
+ - name: Configuring the bios attributes
+ dellemc.openmanage.idrac_bios:
+ <<: *idrac_inputs
+ attributes: "{{ attributes }}"
+ apply_time: "{{ apply_time }}"
+ maintenance_window: "{{ maintenance_window | default(omit) }}"
+ reset_type: "{{ reset_type }}"
+ register: idrac_bios_attributes_out
+ delegate_to: "{{ idrac_bios_delegate }}"
+ when: attributes is defined
+
+ - name: Performing the reset bios operation
+ dellemc.openmanage.idrac_bios:
+ <<: *idrac_inputs
+ reset_bios: "{{ reset_bios }}"
+ reset_type: "{{ reset_type }}"
+ register: idrac_bios_reset_bios_out
+ delegate_to: "{{ idrac_bios_delegate }}"
+ when: reset_bios is defined and reset_bios
+
+ always:
+ - name: Set fact for idrac_bios_out
+ ansible.builtin.set_fact:
+ idrac_bios_out: "{{ idrac_bios_out | default({}) | combine({item.key: item.value}) }}"
+ with_items:
+ - { "key": "clear_pending", "value": "{{ idrac_bios_clear_pending_out }}" }
+ - { "key": "attributes", "value": "{{ idrac_bios_attributes_out }}" }
+ - { "key": "reset_bios", "value": "{{ idrac_bios_reset_bios_out }}" }
+ no_log: true
+
+ - name: Printing idrac_bios_out
+ ansible.builtin.debug:
+ var: idrac_bios_out
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/inventory b/ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/inventory
new file mode 100644
index 000000000..878877b07
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/test.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/test.yml
new file mode 100644
index 000000000..ec7d7f005
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/tests/test.yml
@@ -0,0 +1,6 @@
+---
+- name: Testing idrac_bios
+ hosts: localhost
+ remote_user: root
+ roles:
+ - idrac_bios
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/vars/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/vars/main.yml
new file mode 100644
index 000000000..cdba5a342
--- /dev/null
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/vars/main.yml
@@ -0,0 +1,7 @@
+---
+# vars file for idrac_bios
+idrac_bios_mutual_exclusive_msg: "attributes/clear_pending and reset_bios is mutually exclusive."
+idrac_bios_clear_pending_out: ""
+idrac_bios_attributes_out: ""
+idrac_bios_reset_bios_out: ""
+idrac_bios_delegate: "{{ lookup('ansible.builtin.env', 'RUNON', default='localhost') }}"