diff options
Diffstat (limited to 'ansible_collections/dellemc/openmanage/roles/idrac_boot')
29 files changed, 1937 insertions, 0 deletions
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/README.md b/ansible_collections/dellemc/openmanage/roles/idrac_boot/README.md new file mode 100644 index 000000000..f7903b07e --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/README.md @@ -0,0 +1,373 @@ +# idrac_boot + +Role to configure the boot order settings + +## 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 + +<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 HTTPS socket level timeout in seconds.</td> + </tr> + <tr> + <td>boot_options</td> + <td>false</td> + <td></td> + <td></td> + <td>list</td> + <td>- Options to enable or disable the boot devices.<br>- This is mutually exclusive with I(boot_order), I(boot_source_override_mode), I(boot_source_override_enabled), I(boot_source_override_target), and I(uefi_target_boot_source_override).</td> + </tr> + <tr> + <td> boot_option_reference</td> + <td>false</td> + <td></td> + <td></td> + <td>str</td> + <td>- FQDD of the boot device.<br>- This is mutually exclusive with I(display_name).</td> + </tr> + <tr> + <td> display_name</td> + <td>false</td> + <td></td> + <td></td> + <td>str</td> + <td>- Display name of the boot source device.<br>- This is mutually exclusive with I(boot_option_reference).</td> + </tr> + <tr> + <td> enabled</td> + <td>true</td> + <td></td> + <td></td> + <td>bool</td> + <td>- Enable or disable the boot device.</td> + </tr> + <tr> + <td>boot_order</td> + <td>false</td> + <td></td> + <td></td> + <td>list</td> + <td>- This option allows to set the boot devices in the required boot order sequence.<br>- This is mutually exclusive with I(boot_options).</td> + </tr> + <tr> + <td>boot_source_override_mode</td> + <td>false</td> + <td></td> + <td>'legacy', 'uefi'</td> + <td>str</td> + <td>- The BIOS boot mode (either Legacy or UEFI) to be used when I(boot_source_override_target) boot source is booted.<br>- C(legacy) The system boot in non-UEFI(Legacy) boot mode to the I(boot_source_override_target).<br>- C(uefi) The system boot in UEFI boot mode to the I(boot_source_override_target).<br>- This is mutually exclusive with I(boot_options).</td> + </tr> + <tr> + <td>boot_source_override_enabled</td> + <td>false</td> + <td></td> + <td>'continuous', 'disabled', 'once'</td> + <td>str</td> + <td>- The state of the Boot Source Override feature.<br>- C(disabled), the system boots normally.<br>- C(once), the system boots 1 time to the I(boot_source_override_target).<br>- C(continuous), the system boots to the target specified in the I(boot_source_override_target) until this property is set to Disabled.<br>- The state is set to C(once) for the 1 time boot override and C(continuous) for the remain-active-until—cancelled override. If the state is set C(once) or C(continuous), the value is reset to C(disabled) after the I(boot_source_override_target) actions have completed successfully.<br>- Changes to these options do not alter the BIOS persistent boot order configuration.<br>- This is mutually exclusive with I(boot_options).</td> + </tr> + <tr> + <td>boot_source_override_target</td> + <td>false</td> + <td></td> + <td>'uefi_http', 'sd_card', 'uefi_target', 'utilities', 'bios_setup', 'hdd', 'cd', 'floppy', 'pxe', 'none'</td> + <td>str</td> + <td>- The boot source override targets the device to use during the next boot instead of the normal boot device.<br>- C(pxe) performs PXE boot from the primary NIC.<br>- C(floppy), C(cd), C(hdd), and C(sd_card) performs boot from their devices respectively.<br>- C(bios_setup) performs boot into the native BIOS setup.<br>- C(uefi_http) performs boot from a URI over HTTP.<br>- C(utilities) performs boot from the local utilities.<br>- C(uefi_target) performs boot from the UEFI device path found in I(uefi_target_boot_source_override).<br>- C(none) if the I(boot_source_override_target) is set to a value other than C(none) then the I(boot_source_override_enabled) is automatically set to C(once).<br>- Changes to these options do not alter the BIOS persistent boot order configuration.<br>- This is mutually exclusive with I(boot_options).</td> + </tr> + <tr> + <td>uefi_target_boot_source_override</td> + <td>false</td> + <td></td> + <td></td> + <td>str</td> + <td>- The UEFI device path of the device from which to boot when I(boot_source_override_target) is C(uefi_target).<br>- If I(boot_source_override_target) is set to C(uefi_target), then I(boot_source_override_enabled) cannot be set to c(continuous) because this setting is defined in UEFI as a one-time-boot setting.<br>- Changes to these options do not alter the BIOS persistent boot order configuration.<br>- This is required if I(boot_source_override_target) is C(uefi_target).<br>- This is mutually exclusive with I(boot_options).</td> + </tr> + <tr> + <td>reset_type</td> + <td>false</td> + <td>graceful_restart</td> + <td>'graceful_restart', 'force_restart', 'none'</td> + <td>str</td> + <td>- C(none) Host system is not rebooted and I(job_wait) is not applicable.<br>- C(force_restart) Forcefully reboot the Host system.<br>- C(graceful_restart) Gracefully reboot the Host system.</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 when I(reset_type) is C(force_reset) or C(graceful_reset).</td> + </tr> + <tr> + <td>job_wait_timeout</td> + <td>false</td> + <td>900</td> + <td></td> + <td>int</td> + <td>- The maximum wait time of I(job_wait) in seconds. The job is tracked only for this duration.<br>- This option is applicable when I(job_wait) is C(True).</td> + </tr> + <tr> + <td>resource_id</td> + <td>false</td> + <td></td> + <td></td> + <td>str</td> + <td>- Redfish ID of the resource.</td> + </tr> +</tbody> +</table> + +## Fact variables + +<table> +<thead> + <tr> + <th>Name</th> + <th>Sample</th> + <th>Description</th> + </tr> +</thead> + <tbody> + <tr> + <td>idrac_boot_out</td> + <td>{ + "boot": { + "BootOptions": { + "Description": "Collection of BootOptions", + "Members": [ + { + "BootOptionEnabled": true, + "BootOptionReference": "Boot0005", + "Description": "Current settings of the UEFI Boot option", + "DisplayName": "Integrated RAID Controller 1: VMware ESXi", + "Id": "Boot0005", + "Name": "Uefi Boot Option", + "UefiDevicePath": "HD(1,GPT,740C46A9-4A43-47AA-9C09-65E821376E48,0x40,0x32000)/\\EFI\\VMware\\safeboot64.efi" + }, + { + "BootOptionEnabled": false, + "BootOptionReference": "Boot0004", + "Description": "Current settings of the UEFI Boot option", + "DisplayName": "Unavailable: Windows Boot Manager", + "Id": "Boot0004", + "Name": "Uefi Boot Option", + "UefiDevicePath": "HD(1,GPT,AEB2A96B-5C31-4F8F-9927-B48B08D907BE,0x800,0xF9800)/\\EFI\\Microsoft\\Boot\\bootmgfw.efi" + }, + { + "BootOptionEnabled": true, + "BootOptionReference": "Boot0006", + "Description": "Current settings of the UEFI Boot option", + "DisplayName": "Unavailable: Red Hat Enterprise Linux", + "Id": "Boot0006", + "Name": "Uefi Boot Option", + "UefiDevicePath": "HD(1,GPT,14759088-1AE7-4EA4-A60B-BE82546E21B6,0x800,0x12C000)/\\EFI\\redhat\\shimx64.efi" + }, + { + "BootOptionEnabled": true, + "BootOptionReference": "Boot0003", + "Description": "Current settings of the UEFI Boot option", + "DisplayName": "Unavailable: Rocky Linux", + "Id": "Boot0003", + "Name": "Uefi Boot Option", + "UefiDevicePath": "HD(1,GPT,ADC59C44-A0D3-4917-9376-33EE44DE96F0,0x800,0x12C000)/\\EFI\\rocky\\shimx64.efi" + } + ], + "Name": "Boot Options Collection" + }, + "BootOrder": [ + "Boot0005", + "Boot0004", + "Boot0006", + "Boot0003" + ], + "BootSourceOverrideEnabled": "Disabled", + "BootSourceOverrideMode": "UEFI", + "BootSourceOverrideTarget": "None", + "UefiTargetBootSourceOverride": null + }, + "job": { + "ActualRunningStartTime": "2023-06-19T09:48:41", + "ActualRunningStopTime": "2023-06-19T09:51:53", + "CompletionTime": "2023-06-19T09:51:53", + "Description": "Job Instance", + "EndTime": "TIME_NA", + "Id": "JID_871679370016", + "JobState": "Completed", + "JobType": "BIOSConfiguration", + "Message": "Job completed successfully.", + "MessageArgs": [], + "MessageId": "PR19", + "Name": "Configure: BIOS.Setup.1-1", + "PercentComplete": 100, + "StartTime": "2023-06-19T09:45:36", + "TargetSettingsURI": null + }, + "msg": "Successfully updated the boot settings." +}</td> + <td>Role output of the idrac_boot job.</td> + </tr> + </tbody> +</table> + +## Example Playbook + +``` +- name: Configure the system boot options settings. + ansible.builtin.include_role: + name: dellemc.openmanage.idrac_boot + vars: + hostname: "192.168.0.1" + username: "user_name" + password: "user_password" + boot_options: + - display_name: Hard drive C + enabled: true + - boot_option_reference: NIC.PxeDevice.2-1 + enabled: true +``` + +``` +- name: Configure the boot order settings. + ansible.builtin.include_role: + name: dellemc.openmanage.idrac_boot + vars: + hostname: "192.168.0.1" + username: "user_name" + password: "user_password" + boot_order: + - Boot0001 + - Boot0002 + - Boot0004 + - Boot0003 +``` + +``` +- name: Configure the boot source override mode. + ansible.builtin.include_role: + name: dellemc.openmanage.idrac_boot + vars: + hostname: "192.168.0.1" + username: "user_name" + password: "user_password" + boot_source_override_mode: legacy + boot_source_override_target: cd + boot_source_override_enabled: once +``` + +``` +- name: Configure the UEFI target settings. + ansible.builtin.include_role: + name: dellemc.openmanage.idrac_boot + vars: + hostname: "192.168.0.1" + username: "user_name" + password: "user_password" + boot_source_override_mode: uefi + boot_source_override_target: uefi_target + uefi_target_boot_source_override: "VenHw(3A191845-5F86-4E78-8FCE-C4CFF59F9DAA)" +``` + +``` +- name: Configure the boot source override mode as pxe. + ansible.builtin.include_role: + name: dellemc.openmanage.idrac_boot + vars: + hostname: "192.168.0.1" + username: "user_name" + password: "user_password" + boot_source_override_mode: legacy + boot_source_override_target: pxe + boot_source_override_enabled: continuous +``` + +Author Information +------------------ + +Dell Technologies <br> +Felix Stephen (felix_s@dell.com) 2023 diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/defaults/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/defaults/main.yml new file mode 100644 index 000000000..8a8919ff5 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/defaults/main.yml @@ -0,0 +1,7 @@ +--- +reset_type: graceful_restart +job_wait: true +job_wait_timeout: 900 +https_port: 443 +https_timeout: 30 +validate_certs: true diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/handlers/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/handlers/main.yml new file mode 100644 index 000000000..143bdf802 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for idrac_boot diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/meta/argument_specs.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/meta/argument_specs.yml new file mode 100644 index 000000000..d90140e06 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/meta/argument_specs.yml @@ -0,0 +1,133 @@ +--- +argument_specs: + main: + version_added: "8.0.0" + short_description: Configure the boot order settings + description: + - This role allows to configure the boot order 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 + boot_options: + description: + - Options to enable or disable the boot devices. + - This is mutually exclusive with I(boot_order), I(boot_source_override_mode), + I(boot_source_override_enabled), I(boot_source_override_target), and I(uefi_target_boot_source_override). + type: list + elements: dict + options: + boot_option_reference: + description: + - FQDD of the boot device. + - This is mutually exclusive with I(display_name). + type: str + display_name: + description: + - Display name of the boot source device. + - This is mutually exclusive with I(boot_option_reference). + type: str + enabled: + description: Enable or disable the boot device. + type: bool + required: true + boot_order: + description: + - This option allows to set the boot devices in the required boot order sequence. + - This is mutually exclusive with I(boot_options). + type: list + elements: str + boot_source_override_mode: + description: + - The BIOS boot mode (either Legacy or UEFI) to be used when I(boot_source_override_target) + boot source is booted. + - C(legacy) The system boot in non-UEFI(Legacy) boot mode to the I(boot_source_override_target). + - C(uefi) The system boot in UEFI boot mode to the I(boot_source_override_target). + - This is mutually exclusive with I(boot_options). + type: str + choices: [legacy, uefi] + boot_source_override_enabled: + description: + - The state of the Boot Source Override feature. + - C(disabled), the system boots normally. + - C(once), the system boots 1 time to the I(boot_source_override_target). + - C(continuous), the system boots to the target specified in the I(boot_source_override_target) + until this property is set to Disabled. + - The state is set to C(once) for the 1 time boot override and C(continuous) for the + remain-active-until—cancelled override. If the state is set C(once) or C(continuous), the value is reset + to C(disabled) after the I(boot_source_override_target) actions have completed successfully. + - Changes to these options do not alter the BIOS persistent boot order configuration. + - This is mutually exclusive with I(boot_options). + choices: [continuous, disabled, once] + boot_source_override_target: + description: + - The boot source override targets the device to use during the next boot instead of the normal boot device. + - C(pxe) performs PXE boot from the primary NIC. + - C(floppy), C(cd), C(hdd), and C(sd_card) performs boot from their devices respectively. + - C(bios_setup) performs boot into the native BIOS setup. + - C(uefi_http) performs boot from a URI over HTTP. + - C(utilities) performs boot from the local utilities. + - C(uefi_target) performs boot from the UEFI device path found in I(uefi_target_boot_source_override). + - C(none) if the I(boot_source_override_target) is set to a value other than C(none) then the + I(boot_source_override_enabled) is automatically set to C(once). + - Changes to these options do not alter the BIOS persistent boot order configuration. + - This is mutually exclusive with I(boot_options). + type: str + choices: [uefi_http, sd_card, uefi_target, utilities, bios_setup, hdd, cd, floppy, pxe, none] + uefi_target_boot_source_override: + description: + - The UEFI device path of the device from which to boot when I(boot_source_override_target) is C(uefi_target). + - If I(boot_source_override_target) is set to C(uefi_target), then I(boot_source_override_enabled) cannot be + set to c(continuous) because this setting is defined in UEFI as a one-time-boot setting. + - Changes to these options do not alter the BIOS persistent boot order configuration. + - This is required if I(boot_source_override_target) is C(uefi_target). + - This is mutually exclusive with I(boot_options). + type: str + reset_type: + description: + - C(none) Host system is not rebooted and I(job_wait) is not applicable. + - C(force_restart) Forcefully reboot the Host system. + - C(graceful_restart) Gracefully reboot the Host system. + type: str + choices: [graceful_restart, force_restart, none] + default: graceful_restart + job_wait: + description: + - Provides the option to wait for job completion. + - This is applicable when I(reset_type) is C(force_reset) or C(graceful_reset). + type: bool + default: true + job_wait_timeout: + 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). + type: int + default: 900 + resource_id: + description: Redfish ID of the resource. + type: str diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/meta/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/meta/main.yml new file mode 100644 index 000000000..116f8e05a --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/meta/main.yml @@ -0,0 +1,26 @@ +galaxy_info: + role_name: idrac_boot + author: "Felix Stephen" + description: Role to configure the boot order settings + 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_boot/molecule/boot_options_using_boot_option_reference_enabled_true/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_boot_option_reference_enabled_true/converge.yml new file mode 100644 index 000000000..7db461ce1 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_boot_option_reference_enabled_true/converge.yml @@ -0,0 +1,119 @@ +--- +- name: Testing boot_options_using_boot_option_reference_enabled_true + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_option_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Systems/System.Embedded.1/BootOptions?$expand=*($levels=1)" + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Fetching boot_option_reference from iDRAC + ansible.builtin.uri: + <<: *uri_input + url: "{{ boot_option_uri }}" + method: GET + register: result_data + check_mode: false + no_log: true + + - name: Extracing BootOptionReference from output + ansible.builtin.set_fact: + data: "{{ result_data.json.Members[0].BootOptionReference }}" + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure enabled is false on first boot_option_reference + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_options: + - boot_option_reference: "{{ data | default('') }}" + enabled: false + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115424 - Validate boot_options using boot_option_reference and default enabled + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_options: + - boot_option_reference: "{{ data | default('') }}" + enabled: true + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115424 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115424 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Successfully updated the boot settings." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115424 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_boot_option_reference_enabled_true/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_boot_option_reference_enabled_true/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_boot_option_reference_enabled_true/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_display_name_enabled_false/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_display_name_enabled_false/converge.yml new file mode 100644 index 000000000..9bf8ed1e4 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_display_name_enabled_false/converge.yml @@ -0,0 +1,119 @@ +--- +- name: Testing boot_options_using_display_name_enabled_false + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_option_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Systems/System.Embedded.1/BootOptions?$expand=*($levels=1)" + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Fetching iDRAC + ansible.builtin.uri: + <<: *uri_input + url: "{{ boot_option_uri }}" + method: GET + register: result_data + check_mode: false + no_log: true + + - name: Extracing DisplayName from output + ansible.builtin.set_fact: + data: "{{ result_data.json.Members[0].DisplayName }}" + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure enabled is true for fisrt display_name + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_options: + - display_name: "{{ data | default('') }}" + enabled: true + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115426 - Validate boot_options using display_name and enabled false + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_options: + - display_name: "{{ data | default('') }}" + enabled: false + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115426 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115426 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Successfully updated the boot settings." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115426 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_display_name_enabled_false/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_display_name_enabled_false/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_options_using_display_name_enabled_false/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_legacy_mode_force_restart/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_legacy_mode_force_restart/converge.yml new file mode 100644 index 000000000..92d1958d7 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_legacy_mode_force_restart/converge.yml @@ -0,0 +1,120 @@ +--- +- name: Testing boot_order_using_legacy_mode_force_restart + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_order_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Systems/System.Embedded.1/" + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Fetching boot order from iDRAC + ansible.builtin.uri: + <<: *uri_input + url: "{{ boot_order_uri }}" + method: GET + register: result_data + check_mode: false + no_log: true + + - name: Extracing BootOrder from output + ansible.builtin.set_fact: + data: "{{ result_data.json.Boot.BootOrder | default([]) }}" + + - name: Reversing the boot order + ansible.builtin.set_fact: + reverse_boot_order: "{{ data | reverse | list }}" + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure boot mode is legacy + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_source_override_mode: legacy + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115427 - Validate boot_order with legacy mode with force_restart + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_order: "{{ reverse_boot_order }}" + reset_type: force_restart + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115427 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115427 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Successfully updated the boot settings." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115427 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_legacy_mode_force_restart/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_legacy_mode_force_restart/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_legacy_mode_force_restart/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_uefi_mode_graceful_restart/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_uefi_mode_graceful_restart/converge.yml new file mode 100644 index 000000000..58cd441fe --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_uefi_mode_graceful_restart/converge.yml @@ -0,0 +1,120 @@ +--- +- name: Testing boot_order_using_uefi_mode_graceful_restart + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_order_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Systems/System.Embedded.1/" + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Fetching boot order from iDRAC + ansible.builtin.uri: + <<: *uri_input + url: "{{ boot_order_uri }}" + method: GET + register: result_data + check_mode: false + no_log: true + + - name: Extracing BootOrder from output + ansible.builtin.set_fact: + data: "{{ result_data.json.Boot.BootOrder | default([]) }}" + + - name: Reversing the boot order + ansible.builtin.set_fact: + reverse_boot_order: "{{ data | reverse | list }}" + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure boot mode is uefi + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_source_override_mode: uefi + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115428 - Validate boot_order with uefi mode with graceful_restart + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_order: "{{ reverse_boot_order }}" + reset_type: graceful_restart + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115428 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115428 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Successfully updated the boot settings." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115428 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_uefi_mode_graceful_restart/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_uefi_mode_graceful_restart/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_order_using_uefi_mode_graceful_restart/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml new file mode 100644 index 000000000..076cdd755 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml @@ -0,0 +1,102 @@ +--- +- name: Testing boot_source_override_enabled_as_continuous_reset_type_none + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure boot_source_override_enabled is disabled + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_source_override_enabled: disabled + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115433 - Validate boot_source_override_enabled as continuous + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_source_override_enabled: continuous + reset_type: none + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115433 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115433 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "The boot settings job is triggered successfully." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115433 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml new file mode 100644 index 000000000..8c8d2d443 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml @@ -0,0 +1,102 @@ +--- +- name: Testing boot_source_override_enabled_as_disabled_reset_type_none + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure boot_source_override_enabled is continuous + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_source_override_enabled: continuous + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115431 - Validate boot_source_override_enabled as disabled + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_source_override_enabled: disabled + reset_type: none + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115431 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115431 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "The boot settings job is triggered successfully." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115431 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml new file mode 100644 index 000000000..50bb281b2 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml @@ -0,0 +1,102 @@ +--- +- name: Testing boot_source_override_enabled_as_once_reset_type_none + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure boot_source_override_enabled is disabled + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_source_override_enabled: disabled + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115432 - Validate boot_source_override_enabled as once + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_source_override_enabled: once + reset_type: none + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115432 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115432 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "The boot settings job is triggered successfully." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115432 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml new file mode 100644 index 000000000..86b7b39ea --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml @@ -0,0 +1,116 @@ +--- +- name: Testing boot_source_override_mode_legacy_job_wait_false + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + job_status_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Managers/iDRAC.Embedded.1/Jobs" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure boot mode is uefi + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_source_override_mode: uefi + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115429 - Validate boot_source_override_mode as legacy with job_wait false + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_source_override_mode: legacy + job_wait: false + + - name: Job tracking after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ job_status_uri }}/{{ idrac_boot_out.job.Id }}" + method: GET + register: job_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: job_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115429 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115429 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "The boot settings job is triggered successfully." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115429 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_uefi_with_resource_id/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_uefi_with_resource_id/converge.yml new file mode 100644 index 000000000..a2b6ef922 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_uefi_with_resource_id/converge.yml @@ -0,0 +1,129 @@ +--- +- name: Testing boot_source_override_mode_uefi_with_resource_id + hosts: all + gather_facts: false + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + system_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Systems" + lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" + retry_count: 60 + delay_count: 30 + tasks: + - name: Preparing set_fact for uri + ansible.builtin.set_fact: + uri_input: &uri_input + user: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + headers: + Accept: "application/json" + Content-Type: "application/json" + OData-Version: "4.0" + body_format: "json" + return_content: true + force_basic_auth: true + timeout: "{{ https_timeout }}" + no_log: true + + - name: Fetching resource_id from iDRAC + ansible.builtin.uri: + <<: *uri_input + url: "{{ system_uri }}" + method: GET + register: result_data + check_mode: false + no_log: true + + - name: Extracting resource_id from output + ansible.builtin.set_fact: + resource_id_data: "{{ result_data.json.Members[0]['@odata.id'] | split('/') | last }}" + + - name: Checking for LCStatus before running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Pre-requisite - Making sure boot mode is legacy + check_mode: false + ansible.builtin.import_role: + name: "idrac_boot" + vars: + boot_source_override_mode: legacy + tags: molecule-idempotence-notest + + - name: Checking for LCStatus after running pre-requisite + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: TC-115430 - Validate boot_source_override_mode as uefi with resource_id + ansible.builtin.include_role: + name: "idrac_boot" + vars: + boot_source_override_mode: uefi + resource_id: "{{ resource_id_data }}" + + - name: Job tracking after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ job_status_uri }}/{{ idrac_boot_out.job.Id }}" + method: GET + register: job_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: job_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Checking for LCStatus after performing operation + ansible.builtin.uri: + <<: *uri_input + url: "{{ lc_uri }}" + method: POST + body: {} + register: lc_status_result + check_mode: false + when: idrac_boot_out.changed # noqa: no-handler + until: lc_status_result.json.LCStatus == "Ready" + retries: "{{ retry_count }}" + delay: "{{ delay_count }}" + no_log: true + + - name: Asserting TC-115430 in check mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "Changes found to be applied." + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Asserting TC-115430 in normal mode + ansible.builtin.assert: + that: idrac_boot_out.msg == "The boot settings job is triggered successfully." + when: not ansible_check_mode and idrac_boot_out.changed + + - name: Asserting TC-115430 in idempotence mode + ansible.builtin.assert: + that: + - idrac_boot_out.msg == "No changes found to be applied." + when: not ansible_check_mode and not idrac_boot_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_uefi_with_resource_id/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_uefi_with_resource_id/molecule.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_uefi_with_resource_id/molecule.yml @@ -0,0 +1 @@ +--- diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/default/converge.yml new file mode 100644 index 000000000..08e7ab3be --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/default/converge.yml @@ -0,0 +1,311 @@ +--- +- name: Play 1 - Negative Scenarios + hosts: all + gather_facts: false + tasks: + - name: Play 1 - TC-115436 - Ansible - Role - idrac_boot - Providing wrong hostname + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "WrongHostname" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_source_override_mode: 'uefi' + ignore_unreachable: true + + - name: Verify - TC-115436 - Ansible - Role - idrac_boot - Providing wrong hostname + ansible.builtin.assert: + that: + - "'Unable to communicate with iDRAC WrongHostname' in idrac_boot_out.msg" + + - name: TC-115437 - Ansible - Role - idrac_boot - Providing wrong username + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "wrongUsername" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_source_override_mode: 'uefi' + register: idrac_boot_error_reg + ignore_errors: true + + - name: Verify - TC-115437 - Ansible - Role - idrac_boot - Providing wrong username + ansible.builtin.assert: + that: + - "'Unable to communicate with iDRAC' in idrac_boot_out.msg" + + - name: TC-115438 - Ansible - Role - idrac_boot - Providing wrong password + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "wrongPassword" + validate_certs: false + boot_source_override_mode: 'uefi' + ignore_errors: true + ignore_unreachable: true + register: idrac_boot_error_reg + + - name: Verify - TC-115438 - Ansible - Role - idrac_boot - Providing wrong password + ansible.builtin.assert: + that: + - "'Unable to communicate with iDRAC' in idrac_boot_out.msg" + +- name: Play 2 - TC-115439 - Ansible - Role - idrac_boot - Providing invalid https_port + hosts: all + gather_facts: false + tasks: + - name: TC-115439 - Ansible - Role - idrac_boot - Providing invalid https_port + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + https_port: 999999 + validate_certs: false + boot_source_override_mode: 'uefi' + ignore_unreachable: true + + - name: Verify - TC-115439 - Ansible - Role - idrac_boot - Providing invalid https_port + ansible.builtin.assert: + that: + - "'Unable to communicate with iDRAC' in idrac_boot_out.msg" + +- name: Play 3 - TC-115440 - Ansible - Role - idrac_boot - Providing wrong resource_id + hosts: all + gather_facts: false + tasks: + - name: TC-115440 - Ansible - Role - idrac_boot - Providing wrong resource_id + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + resource_id: "Invalid.System.ID" + validate_certs: false + boot_source_override_mode: 'uefi' + ignore_errors: true + register: idrac_boot_error_reg + + - name: Verify - TC-115440 - Ansible - Role - idrac_boot - Providing wrong resource_id + ansible.builtin.assert: + that: + - "'HTTP Error 404' in idrac_boot_out.msg" + +- name: Play 4 - TC-115441 - Ansible - Role - idrac_boot - Providing wrong ca_path + hosts: all + gather_facts: false + tasks: + - name: TC-115441 - Ansible - Role - idrac_boot - Providing wrong ca_path + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + ca_path: "/root/filenotexists.pem" + validate_certs: false + boot_source_override_mode: 'uefi' + ignore_errors: true + register: idrac_boot_error_reg + + - name: Verify - TC-115441 - Ansible - Role - idrac_boot - Providing wrong ca_path + ansible.builtin.assert: + that: + - idrac_boot_out.failed # TBD + +- name: Play 5 - TC-115442 - Ansible - Role - idrac_boot - Providing invalid https_timeout + hosts: all + gather_facts: false + tasks: + - name: TC-115442 - Ansible - Role - idrac_boot - Providing invalid https_timeout + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + https_timeout: -1000 + validate_certs: false + boot_source_override_mode: 'uefi' + ignore_errors: true + register: idrac_boot_error_reg + + - name: Verify - TC-115442 - Ansible - Role - idrac_boot - Providing invalid https_timeout + ansible.builtin.assert: + that: + - "'Timeout value out of range' == idrac_boot_out.msg" + +- name: Play 6 - TC-115443 - Ansible - Role - idrac_boot - Providing invalid job_wait_timeout + hosts: all + gather_facts: false + tasks: + - name: TC-115443 - Ansible - Role - idrac_boot - Providing invalid job_wait_timeout + block: + - name: TC-115443 - Ansible - Role - idrac_boot - Providing invalid job_wait_timeout + ansible.builtin.import_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + job_wait_timeout: -1000 + validate_certs: false + boot_source_override_mode: 'legacy' + register: idrac_boot_error_reg + rescue: + - name: Verify - TC-115443 - Ansible - Role - idrac_boot - Providing invalid job_wait_timeout + ansible.builtin.assert: + that: + - "'The parameter job_wait_timeout value cannot be negative or zero.' == ansible_failed_result.msg" + +- name: Play 7 - TC-115444 - Ansible - Role - idrac_boot - Validate all the mutually exclusive scenarios + hosts: all + gather_facts: false + tasks: + - name: Check 1 - TC-115444 - Entering block + block: + - name: Check 1 - TC-115444 - mutual exclusivity between boot_option_reference and display_name + ansible.builtin.include_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_options: + - display_name: Hard drive C + boot_option_reference: NIC.PxeDevice.2-1 + enabled: true + ignore_errors: true + register: idrac_boot_error_reg + rescue: + - name: Verify - Check 1 - TC-115444 - mutual exclusivity between boot_option_reference and display_name + ansible.builtin.assert: + that: + - "'parameters are mutually exclusive' in idrac_boot_out.msg" + - "'boot_option_reference' in idrac_boot_out.msg" + - "'display_name' in idrac_boot_out.msg" + - idrac_boot_out.failed + + - name: Check 2 - TC-115444 - Entering block + block: + - name: Check 2 - TC-115444 - mutual exclusivity between boot_options and boot_order + ansible.builtin.include_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_options: + - display_name: Hard drive C + enabled: true + boot_order: + - Boot0001 + - Boot0002 + ignore_errors: true + register: idrac_boot_error_reg + rescue: + - name: Verify - Check 2 - TC-115444 - mutual exclusivity between boot_options and boot_order + ansible.builtin.assert: + that: > + "'parameters are mutually exclusive: boot_options|boot_order found in + boot_options' == idrac_boot_out.msg" + + - name: Check 3 - TC-115444 - Entering block + block: + - name: Check 3 - TC-115444 - mutual exclusivity between boot_options and boot_source_override_mode + ansible.builtin.include_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_options: + - display_name: Hard drive C + enabled: true + boot_source_override_mode: legacy + ignore_errors: true + register: idrac_boot_error_reg + rescue: + - name: Verify - Check 3 - TC-115444 - mutual exclusivity between boot_options and boot_source_override_mode + ansible.builtin.assert: + that: > + "'parameters are mutually exclusive: boot_options|boot_source_override_mode found in + boot_options' == idrac_boot_out.msg" + + - name: Check 4 - TC-115444 - Entering block + block: + - name: Check 4 - TC-115444 - mutual exclusivity between boot_options and boot_source_override_enabled + ansible.builtin.include_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_options: + - display_name: Hard drive C + enabled: true + boot_source_override_enabled: once + ignore_errors: true + register: idrac_boot_error_reg + rescue: + - name: Verify - Check 4 - TC-115444 - mutual exclusivity between boot_options and boot_source_override_enabled + ansible.builtin.assert: + that: > + "'parameters are mutually exclusive: boot_options|boot_source_override_enabled found in + boot_options' == idrac_boot_out.msg" + + - name: Check 5 - TC-115444 - Entering block + block: + - name: Check 5 - TC-115444 - mutual exclusivity between boot_options and boot_source_override_target + ansible.builtin.include_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_options: + - display_name: Hard drive C + enabled: true + boot_source_override_target: cd + ignore_errors: true + register: idrac_boot_error_reg + rescue: + - name: Verify - Check 5 - TC-115444 - mutual exclusivity between boot_options and boot_source_override_target + ansible.builtin.assert: + that: > + "'parameters are mutually exclusive: boot_options|boot_source_override_target found in + boot_options' == idrac_boot_out.msg" + + - name: Check 6 - TC-115444 - Entering block + block: + - name: Check 6 - TC-115444 - mutual exclusivity between boot_options and uefi_target_boot_source_override + ansible.builtin.include_role: + name: idrac_boot + vars: + hostname: "{{ lookup('ansible.builtin.env', 'IDRAC_IP') }}" + username: "{{ lookup('ansible.builtin.env', 'IDRAC_USER') }}" + password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" + validate_certs: false + boot_options: + - display_name: Hard drive C + enabled: true + uefi_target_boot_source_override: "VenHw(3A191845-5F86-4E78-8FCE-C4CFF59F9DAA)" + ignore_errors: true + register: idrac_boot_error_reg + rescue: + - name: Verify - Check 6 - TC-115444 - mutual exclusivity between boot_options and uefi_target_boot_source_override + ansible.builtin.assert: + that: > + "'parameters are mutually exclusive: boot_options|uefi_target_boot_source_override found in + boot_options' == idrac_boot_out.msg" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/default/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/default/molecule.yml new file mode 100644 index 000000000..fbbe91b9c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/default/molecule.yml @@ -0,0 +1,9 @@ +--- +scenario: + test_sequence: + - cleanup + - destroy + - syntax + - create + - converge + - destroy diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/tasks/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/tasks/main.yml new file mode 100644 index 000000000..78047aa51 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/tasks/main.yml @@ -0,0 +1,27 @@ +--- +- name: Fail when job_wait_timeout is negative. + ansible.builtin.fail: + msg: "{{ idrac_boot_job_wait_timeout_err }}" + when: job_wait_timeout < 1 + +- name: Configure the system boot settings + dellemc.openmanage.idrac_boot: + idrac_ip: "{{ hostname }}" + idrac_user: "{{ username }}" + idrac_password: "{{ password }}" + idrac_port: "{{ https_port }}" + ca_path: "{{ ca_path | default(omit) }}" + validate_certs: "{{ validate_certs }}" + timeout: "{{ https_timeout }}" + boot_options: "{{ boot_options | default(omit) }}" + boot_order: "{{ boot_order | default(omit) }}" + boot_source_override_mode: "{{ boot_source_override_mode | default(omit) }}" + boot_source_override_enabled: "{{ boot_source_override_enabled | default(omit) }}" + boot_source_override_target: "{{ boot_source_override_target | default(omit) }}" + uefi_target_boot_source_override: "{{ uefi_target_boot_source_override | default(omit) }}" + reset_type: "{{ reset_type }}" + job_wait: "{{ job_wait }}" + job_wait_timeout: "{{ job_wait_timeout }}" + resource_id: "{{ resource_id | default(omit) }}" + register: idrac_boot_out + delegate_to: "{{ idrac_boot_delegate }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/tests/inventory b/ansible_collections/dellemc/openmanage/roles/idrac_boot/tests/inventory new file mode 100644 index 000000000..878877b07 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/tests/test.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/tests/test.yml new file mode 100644 index 000000000..f043a741f --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/tests/test.yml @@ -0,0 +1,6 @@ +--- +- name: Testing for idrac boot + hosts: localhost + remote_user: root + roles: + - idrac_boot diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/vars/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/vars/main.yml new file mode 100644 index 000000000..55198828b --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/vars/main.yml @@ -0,0 +1,3 @@ +--- +idrac_boot_delegate: "{{ lookup('ansible.builtin.env', 'RUNON', default='localhost') }}" +idrac_boot_job_wait_timeout_err: "The parameter job_wait_timeout value cannot be negative or zero." |