diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:18:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:18:41 +0000 |
commit | b643c52cf29ce5bbab738b43290af3556efa1ca9 (patch) | |
tree | 21d5c53d7a9b696627a255777cefdf6f78968824 /ansible_collections/dellemc/openmanage/roles | |
parent | Releasing progress-linux version 9.5.1+dfsg-1~progress7.99u1. (diff) | |
download | ansible-b643c52cf29ce5bbab738b43290af3556efa1ca9.tar.xz ansible-b643c52cf29ce5bbab738b43290af3556efa1ca9.zip |
Merging upstream version 10.0.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/dellemc/openmanage/roles')
126 files changed, 2307 insertions, 749 deletions
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 index 46d74222a..a91b20b69 100644 --- 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 @@ -14,13 +14,10 @@ /iDRAC.Embedded.1/Jobs?$expand=*($levels=1)" - name: Fetch Bios Jobs Data - when: idrac_bios_uri_data.json.Members | length > 0 + loop: "{{ idrac_bios_uri_data.json.Members }}" + when: item.JobType == 'BIOSConfiguration' and item.JobState in ['Scheduled', 'Scheduling'] 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' ]" + idrac_bios_jobs_items: "{{ idrac_bios_jobs_items | default([]) + [item] }}" no_log: true - name: Block for creating a bios job as a pre-requisite 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 index 44439ab07..622c48964 100644 --- 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 @@ -49,7 +49,7 @@ 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.')" + to')" - name: Block to update attributes with maintenance window with invalid duration 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 index 7db461ce1..4aa8e7661 100644 --- 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 @@ -55,6 +55,11 @@ delay: "{{ delay_count }}" no_log: true + - name: Waiting for the iDRAC to be available + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest + - name: Pre-requisite - Making sure enabled is false on first boot_option_reference check_mode: false ansible.builtin.import_role: @@ -65,20 +70,6 @@ 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" @@ -101,6 +92,11 @@ delay: "{{ delay_count }}" no_log: true + - name: Waiting for the iDRAC to be available + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest + - name: Asserting TC-115424 in check mode ansible.builtin.assert: that: idrac_boot_out.msg == "Changes found to be applied." 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 index 9bf8ed1e4..342873325 100644 --- 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 @@ -73,7 +73,6 @@ 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 }}" 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 index 92d1958d7..851a4cc73 100644 --- 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 @@ -29,23 +29,6 @@ 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 @@ -58,6 +41,12 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest + + - name: Waiting for the iDRAC to be available + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - name: Pre-requisite - Making sure boot mode is legacy check_mode: false @@ -67,6 +56,24 @@ boot_source_override_mode: legacy tags: molecule-idempotence-notest + - 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 }}" + tags: molecule-idempotence-notest + - name: Checking for LCStatus after running pre-requisite ansible.builtin.uri: <<: *uri_input @@ -80,12 +87,18 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest + + - name: Waiting for the iDRAC to be available + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - 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 }}" + boot_order: "{{ reverse_boot_order | default(data) }}" reset_type: force_restart - name: Checking for LCStatus after performing operation @@ -101,6 +114,12 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest + + - name: Waiting for the iDRAC to be available + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - name: Asserting TC-115427 in check mode ansible.builtin.assert: 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 index 58cd441fe..48d24128a 100644 --- 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 @@ -29,23 +29,6 @@ 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 @@ -58,6 +41,12 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest + + - name: Wait for 60 seconds + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - name: Pre-requisite - Making sure boot mode is uefi check_mode: false @@ -67,6 +56,24 @@ boot_source_override_mode: uefi tags: molecule-idempotence-notest + - 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 }}" + tags: molecule-idempotence-notest + - name: Checking for LCStatus after running pre-requisite ansible.builtin.uri: <<: *uri_input @@ -75,17 +82,22 @@ 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 + tags: molecule-idempotence-notest + + - name: Wait for 60 seconds + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - 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 }}" + boot_order: "{{ reverse_boot_order | default(data) }}" reset_type: graceful_restart - name: Checking for LCStatus after performing operation @@ -96,11 +108,11 @@ 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 + tags: molecule-idempotence-notest - name: Asserting TC-115428 in check mode ansible.builtin.assert: 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 index 076cdd755..a1e11acdd 100644 --- 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 @@ -40,6 +40,12 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest + + - name: Wait for 60 seconds + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - name: Pre-requisite - Making sure boot_source_override_enabled is disabled check_mode: false @@ -57,11 +63,16 @@ 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 + tags: molecule-idempotence-notest + + - name: Wait for 60 seconds + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - name: TC-115433 - Validate boot_source_override_enabled as continuous ansible.builtin.include_role: @@ -83,6 +94,12 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest + + - name: Wait for 60 seconds + ansible.builtin.wait_for: + timeout: 60 + tags: molecule-idempotence-notest - name: Asserting TC-115433 in check mode ansible.builtin.assert: @@ -93,10 +110,4 @@ - 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 + when: not ansible_check_mode 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 index ed97d539c..608be28b1 100644 --- 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 @@ -1 +1,7 @@ --- +scenario: + test_sequence: + - create + - check + - converge + - destroy 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 index 50bb281b2..8fc9af6dc 100644 --- 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 @@ -57,7 +57,6 @@ 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 }}" @@ -90,13 +89,8 @@ 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 + - name: Asserting TC-115432 in normal mode or idempotence mode ansible.builtin.assert: that: - - idrac_boot_out.msg == "No changes found to be applied." + - 'idrac_boot_out.msg == "The boot settings job is triggered successfully." or "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/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml index 86b7b39ea..85b84477f 100644 --- 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 @@ -58,7 +58,6 @@ 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 }}" @@ -78,11 +77,12 @@ method: GET register: job_status_result check_mode: false - when: idrac_boot_out.changed # noqa: no-handler - until: job_status_result.json.LCStatus == "Ready" + when: not ansible_check_mode # noqa: no-handler + until: job_status_result.json.JobState == "Completed" retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest - name: Checking for LCStatus after performing operation ansible.builtin.uri: @@ -92,7 +92,6 @@ 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 }}" @@ -104,13 +103,8 @@ 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 + - name: Asserting TC-115429 in normal mode or idempotence mode ansible.builtin.assert: that: - - idrac_boot_out.msg == "No changes found to be applied." + - 'idrac_boot_out.msg == "The boot settings job is triggered successfully." or "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/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_uefi_with_resource_id/converge.yml index a2b6ef922..3024c3678 100644 --- 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 @@ -8,6 +8,7 @@ password: "{{ lookup('ansible.builtin.env', 'IDRAC_PASSWORD') }}" validate_certs: false system_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Systems" + job_status_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Managers/iDRAC.Embedded.1/Jobs" lc_uri: "https://{{ hostname }}:{{ https_port }}/redfish/v1/Dell/Managers/iDRAC.Embedded.1/DellLCService/Actions/DellLCService.GetRemoteServicesAPIStatus" retry_count: 60 delay_count: 30 @@ -54,6 +55,7 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest - name: Pre-requisite - Making sure boot mode is legacy check_mode: false @@ -71,7 +73,6 @@ 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 }}" @@ -91,11 +92,12 @@ method: GET register: job_status_result check_mode: false - when: idrac_boot_out.changed # noqa: no-handler - until: job_status_result.json.LCStatus == "Ready" + when: not ansible_check_mode # noqa: no-handler + until: job_status_result.json.JobState == "Completed" retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest - name: Checking for LCStatus after performing operation ansible.builtin.uri: @@ -110,6 +112,7 @@ retries: "{{ retry_count }}" delay: "{{ delay_count }}" no_log: true + tags: molecule-idempotence-notest - name: Asserting TC-115430 in check mode ansible.builtin.assert: @@ -119,7 +122,7 @@ - name: Asserting TC-115430 in normal mode ansible.builtin.assert: - that: idrac_boot_out.msg == "The boot settings job is triggered successfully." + that: idrac_boot_out.msg == "Successfully updated the boot settings." when: not ansible_check_mode and idrac_boot_out.changed - name: Asserting TC-115430 in idempotence mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CA/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CA/converge.yml index 64e2a242f..3e7bb67c6 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CA/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CA/converge.yml @@ -21,9 +21,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -55,9 +55,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "export" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CSC/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CSC/converge.yml index 2a8708f27..a78651306 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CSC/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CSC/converge.yml @@ -22,9 +22,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -57,9 +57,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "export" @@ -98,9 +98,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -133,9 +133,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "export" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CTC/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CTC/converge.yml index cdf53ff08..5186af134 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CTC/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CTC/converge.yml @@ -21,9 +21,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -55,9 +55,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "export" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CustomCertificate/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CustomCertificate/converge.yml index 0f07f68ca..119105b5a 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CustomCertificate/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CustomCertificate/converge.yml @@ -15,9 +15,9 @@ ansible.builtin.include_tasks: file: ../__extract_firmware_version.yml vars: - idrac_ip: "{{ lookup('env', 'hostname') }}" - idrac_user: "{{ lookup('env', 'username') }}" - idrac_password: "{{ lookup('env', 'password') }}" + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" - name: Set expected firmware version ansible.builtin.set_fact: @@ -40,9 +40,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -97,9 +97,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "export" @@ -156,9 +156,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/HTTPS/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/HTTPS/converge.yml index 28cdf16b8..610fdccd2 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/HTTPS/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/HTTPS/converge.yml @@ -21,9 +21,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -55,9 +55,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "export" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/SSLKEY/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/SSLKEY/converge.yml index c90e4e53e..4937fb8e5 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/SSLKEY/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/SSLKEY/converge.yml @@ -13,9 +13,9 @@ ansible.builtin.include_tasks: file: ../__extract_firmware_version.yml vars: - idrac_ip: "{{ lookup('env', 'hostname') }}" - idrac_user: "{{ lookup('env', 'username') }}" - idrac_password: "{{ lookup('env', 'password') }}" + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" - name: Set expected firmware version ansible.builtin.set_fact: @@ -38,9 +38,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml index 56c26b4a6..021cec95f 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml @@ -39,9 +39,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "export" @@ -62,9 +62,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -84,9 +84,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -106,9 +106,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "import" @@ -128,8 +128,8 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'invalid_password') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" @@ -153,8 +153,8 @@ name: dellemc.openmanage.idrac_certificate vars: hostname: "999.999.999.999" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "reset" certificate_type: "HTTPS" @@ -173,9 +173,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" username: invalid - password: "{{ lookup('env', 'password') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "reset" certificate_type: "HTTPS" @@ -193,8 +193,8 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: invalid validate_certs: false command: "reset" @@ -213,9 +213,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "invalid" certificate_type: "HTTPS" @@ -233,9 +233,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "export" certificate_type: "HTTPS" @@ -256,9 +256,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "import" certificate_type: "CSC" @@ -279,9 +279,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "generate_csr" certificate_type: "HTTPS" @@ -307,9 +307,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "import" certificate_type: "CUSTOMCERTIFICATE" @@ -332,9 +332,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "import" certificate_type: "CUSTOMCERTIFICATE" @@ -356,9 +356,9 @@ ansible.builtin.import_role: name: dellemc.openmanage.idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: "import" certificate_type: "HTTPS" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/generateCSR/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/generateCSR/converge.yml index 9f57c7e84..ee37021b9 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/generateCSR/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/generateCSR/converge.yml @@ -16,9 +16,9 @@ ansible.builtin.import_role: name: idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "generate_csr" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/reset/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/reset/converge.yml index 8a3e23ab5..1d78d3389 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/reset/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/reset/converge.yml @@ -10,9 +10,9 @@ ansible.builtin.import_role: name: idrac_certificate vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ca_path: "{{ ca_cert_path }}" command: "reset" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/cleanup.yml b/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/cleanup.yml index 9ade81e90..cccd89d7b 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/cleanup.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/cleanup.yml @@ -14,18 +14,18 @@ nfs_mount_path: "{{ lookup('env', 'nfs_mount_path') }}" cifs_mount_path: "{{ lookup('env', 'cifs_mount_path') }}" - nfs_url: "{{ lookup('env', 'NFS_URL') }}" - cifs_url: "{{ lookup('env', 'CIFS_URL') }}" - cifs_username: "{{ lookup('env', 'CIFS_USERNAME') }}" - cifs_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + nfs_url: "{{ lookup('env', 'nfs_url') }}" + cifs_url: "{{ lookup('env', 'cifs_url') }}" + cifs_username: "{{ lookup('env', 'cifs_username') }}" + cifs_password: "{{ lookup('env', 'cifs_password') }}" - https_url: "{{ lookup('env', 'HTTPS_URL') }}" - https_username: "{{ lookup('env', 'HTTPS_USERNAME') }}" - https_password: "{{ lookup('env', 'HTTPS_PASSWORD') }}" + https_url: "{{ lookup('env', 'https_url') }}" + https_username: "{{ lookup('env', 'https_username') }}" + https_password: "{{ lookup('env', 'https_password') }}" - http_url: "{{ lookup('env', 'HTTP_URL') }}" - http_username: "{{ lookup('env', 'HTTP_USERNAME') }}" - http_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" + http_url: "{{ lookup('env', 'http_url') }}" + http_username: "{{ lookup('env', 'http_username') }}" + http_password: "{{ lookup('env', 'http_password') }}" tasks: - name: Checking file exists in NFS mount localhost ansible.builtin.stat: diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/converge.yml index 8073a85bc..7b4e215c2 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/converge.yml @@ -10,18 +10,18 @@ nfs_mount_path: "{{ lookup('env', 'nfs_mount_path') }}" cifs_mount_path: "{{ lookup('env', 'nfs_mount_path') }}" - nfs_url: "{{ lookup('env', 'NFS_URL') }}" - cifs_url: "{{ lookup('env', 'CIFS_URL') }}" - cifs_username: "{{ lookup('env', 'CIFS_USERNAME') }}" - cifs_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + nfs_url: "{{ lookup('env', 'nfs_url') }}" + cifs_url: "{{ lookup('env', 'cifs_url') }}" + cifs_username: "{{ lookup('env', 'cifs_username') }}" + cifs_password: "{{ lookup('env', 'cifs_password') }}" - https_url: "{{ lookup('env', 'HTTPS_URL') }}" - https_username: "{{ lookup('env', 'HTTPS_USERNAME') }}" - https_password: "{{ lookup('env', 'HTTPS_PASSWORD') }}" + https_url: "{{ lookup('env', 'https_url') }}" + https_username: "{{ lookup('env', 'https_username') }}" + https_password: "{{ lookup('env', 'https_password') }}" - http_url: "{{ lookup('env', 'HTTP_URL') }}" - http_username: "{{ lookup('env', 'HTTP_USERNAME') }}" - http_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" + http_url: "{{ lookup('env', 'http_url') }}" + http_username: "{{ lookup('env', 'http_username') }}" + http_password: "{{ lookup('env', 'http_password') }}" gather_facts: false tasks: - name: Exporting SCP local path with all components diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/verify.yml b/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/verify.yml index 25206e2d3..dc1cd1815 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/verify.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_export_server_config_profile/molecule/default/verify.yml @@ -14,18 +14,18 @@ nfs_mount_path: "{{ lookup('env', 'nfs_mount_path') }}" cifs_mount_path: "{{ lookup('env', 'cifs_mount_path') }}" - nfs_url: "{{ lookup('env', 'NFS_URL') }}" - cifs_url: "{{ lookup('env', 'CIFS_URL') }}" - cifs_username: "{{ lookup('env', 'CIFS_USERNAME') }}" - cifs_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + nfs_url: "{{ lookup('env', 'nfs_url') }}" + cifs_url: "{{ lookup('env', 'cifs_url') }}" + cifs_username: "{{ lookup('env', 'cifs_username') }}" + cifs_password: "{{ lookup('env', 'cifs_password') }}" - https_url: "{{ lookup('env', 'HTTPS_URL') }}" - https_username: "{{ lookup('env', 'HTTPS_USERNAME') }}" - https_password: "{{ lookup('env', 'HTTPS_PASSWORD') }}" + https_url: "{{ lookup('env', 'https_url') }}" + https_username: "{{ lookup('env', 'https_username') }}" + https_password: "{{ lookup('env', 'https_password') }}" - http_url: "{{ lookup('env', 'HTTP_URL') }}" - http_username: "{{ lookup('env', 'HTTP_USERNAME') }}" - http_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" + http_url: "{{ lookup('env', 'http_url') }}" + http_username: "{{ lookup('env', 'http_username') }}" + http_password: "{{ lookup('env', 'http_password') }}" tasks: - name: Checking exported file exists in Local path ansible.builtin.stat: diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/cifs_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/cifs_share/converge.yml index 161a35cf4..1ebd565bb 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/cifs_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/cifs_share/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'cifsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/default/converge.yml index bc30806f4..43a3ece9b 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/default/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/default/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" @@ -31,9 +31,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" @@ -56,9 +56,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" @@ -80,9 +80,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/ftp_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/ftp_share/converge.yml index a94da723a..48ecbc93e 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/ftp_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/ftp_share/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: idrac_firmware vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'ftpshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/http_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/http_share/converge.yml index 82df756b5..c34cc7d32 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/http_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/http_share/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/https_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/https_share/converge.yml index a94983cae..b1f7805ad 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/https_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/https_share/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/httpsproxy_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/httpsproxy_share/converge.yml index b4bd4bdc1..d4b44b358 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/httpsproxy_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/httpsproxy_share/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsproxy') }}" share_user: "{{ lookup('env', 'shareuser') }}" @@ -21,8 +21,8 @@ proxy_server: "{{ lookup('env', 'proxyserver') }}" proxy_type: "HTTP" proxy_port: 3128 - proxy_uname: "{{ lookup('env', 'proxyuname') }}" - proxy_passwd: "{{ lookup('env', 'proxypass') }}" + proxy_uname: "{{ lookup('env', 'proxy_username') }}" + proxy_passwd: "{{ lookup('env', 'proxy_password') }}" catalog_file_name: "Catalog.xml" - name: "Verifying update firmware from repository on a HTTPS via parameter proxy share in check mode" @@ -48,9 +48,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false reboot: true job_wait: true @@ -81,9 +81,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsproxy') }}" share_user: "{{ lookup('env', 'shareuser') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/negative_scenarios/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/negative_scenarios/converge.yml index 37b959272..98800e160 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/negative_scenarios/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/negative_scenarios/converge.yml @@ -8,15 +8,13 @@ name: idrac_firmware vars: hostname: "invalidHostname" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" share_name: "{{ lookup('env', 'httpshare') }}" catalog_file_name: "Catalog.xml" reboot: true job_wait: true apply_update: true - ignore_errors: true - register: idrac_firmware_result - name: "Verifying Updating firmware with an invalid hostname" ansible.builtin.assert: @@ -27,9 +25,9 @@ ansible.builtin.import_role: name: idrac_firmware vars: - hostname: "{{ lookup('env', 'hostname') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" username: "invalidUsername" - password: "{{ lookup('env', 'password') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" share_name: "{{ lookup('env', 'httpshare') }}" catalog_file_name: "Catalog.xml" reboot: true @@ -47,10 +45,10 @@ ansible.builtin.import_role: name: idrac_firmware vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "invalidPassword" - share_name: "{{ lookup('env', 'httpshare') }}" + share_name: "{{ lookup('env', 'httpsshare') }}" catalog_file_name: "Catalog.xml" reboot: true job_wait: true @@ -67,11 +65,11 @@ ansible.builtin.import_role: name: idrac_firmware vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" - share_name: "{{ lookup('env', 'httpshare') }}" - ca_path: "{{ lookup('env', 'capath') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + share_name: "{{ lookup('env', 'httpsshare') }}" + ca_path: "/invalid/ca/path.cert" catalog_file_name: "Catalog.xml" reboot: true job_wait: true @@ -82,15 +80,15 @@ - name: "Verifying Updating firmware with an invalid ca_path" ansible.builtin.assert: that: - - idrac_firmware_out.msg == "Firmware update failed." + - "'Incorrect username or password, unreachable iDRAC IP or a failure in TLS/SSL handshake.' in idrac_firmware_out.msg" - name: Updating firmware with catalog file without extension ansible.builtin.import_role: name: idrac_firmware vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" share_name: "{{ lookup('env', 'httpshare') }}" reboot: true job_wait: true @@ -108,9 +106,9 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "invalidUser" @@ -118,21 +116,24 @@ reboot: true job_wait: true apply_update: true - catalog_file_name: "Catalog.xml" + catalog_file_name: "catalog.xml" + ignore_errors: true + register: idrac_firmware_result - name: "Verifying update firmware from repository on a HTTPS Share with invalid share_user" ansible.builtin.assert: that: - - idrac_firmware_out.msg == "Unable to complete the operation because the catalog name entered has either unsupported firmware packages - or same version installed on the server." + # - idrac_firmware_out.msg == "Unable to complete the operation because the catalog name entered has either unsupported firmware packages + # or same version installed on the server." + - "'The specified user credentials necessary for downloading an update package were not correct.' in idrac_firmware_out.msg" - name: Update firmware from repository on HTTPS Share with invalid share_password ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" @@ -140,24 +141,26 @@ reboot: true job_wait: true apply_update: true - catalog_file_name: "Catalog.xml" + catalog_file_name: "catalog.xml" + ignore_errors: true register: idrac_firmware_result - name: "Verifying update firmware from repository on a HTTPS Share with invalid share_password" ansible.builtin.assert: that: - - idrac_firmware_out.msg == "Unable to complete the operation because the catalog name entered has either unsupported firmware packages - or same version installed on the server." + # - idrac_firmware_out.msg == "Unable to complete the operation because the catalog name entered has either unsupported firmware packages + # or same version installed on the server." + - "'The specified user credentials necessary for downloading an update package were not correct.' in idrac_firmware_out.msg" - name: Update firmware from repository on a HTTPS via parameter proxy Share with invalid proxy_uname ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false - share_name: "{{ lookup('env', 'httpsproxy') }}" + share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" share_password: "{{ lookup('env', 'sharepassword') }}" reboot: true @@ -166,10 +169,10 @@ proxy_support: "ParametersProxy" proxy_server: "{{ lookup('env', 'proxyserver') }}" proxy_type: "HTTP" - proxy_port: 3128 - proxy_uname: "invalidUname" - proxy_passwd: "{{ lookup('env', 'proxypass') }}" - catalog_file_name: "Catalog.xml" + proxy_port: "{{ lookup('env', 'proxyport') }}" + proxy_uname: "{{ lookup('env', 'proxy_username') }}" + proxy_passwd: "{{ lookup('env', 'proxy_password') }}" + catalog_file_name: "catalog.xml" - name: "Verifying update firmware from repository on a HTTPS via parameter proxy share with invalid proxy_uname" ansible.builtin.assert: @@ -181,11 +184,11 @@ ansible.builtin.import_role: name: "idrac_firmware" vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false - share_name: "{{ lookup('env', 'httpsproxy') }}" + share_name: "{{ lookup('env', 'httpsshare') }}" share_user: "{{ lookup('env', 'shareuser') }}" share_password: "{{ lookup('env', 'sharepassword') }}" reboot: true @@ -194,13 +197,17 @@ proxy_support: "ParametersProxy" proxy_server: "{{ lookup('env', 'proxyserver') }}" proxy_type: "HTTP" - proxy_port: 3128 - proxy_uname: "{{ lookup('env', 'proxyuname') }}" + proxy_port: "{{ lookup('env', 'proxyport') }}" + proxy_uname: "{{ lookup('env', 'proxy_username') }}" proxy_passwd: "invalidPasswd" - catalog_file_name: "Catalog.xml" + catalog_file_name: "catalog.xml" + ignore_errors: true + register: idrac_firmware_result - name: "Verifying update firmware from repository on a HTTPS via parameter proxy share with invalid proxy_passwd" ansible.builtin.assert: that: - - idrac_firmware_out.msg == "Unable to complete the operation because the catalog name entered has either unsupported firmware packages - or same version installed on the server." + # - idrac_firmware_out.msg == "Unable to complete the operation because the catalog name entered has either unsupported firmware packages + # or same version installed on the server." + - "'Unable to transfer file' in idrac_firmware_out.msg" + - "'because of some unknown reasons.' in idrac_firmware_out.msg" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/nfs_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/nfs_share/converge.yml index 89e55838c..d9d496f3a 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/nfs_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_firmware/molecule/nfs_share/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: idrac_firmware vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" share_name: "{{ lookup('env', 'nfsshare') }}" validate_certs: false reboot: true diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml index adb6fcf5f..9aab189c2 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml @@ -4,9 +4,9 @@ connection: local gather_facts: true vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - PCIeSSDBackPlane @@ -23,22 +23,44 @@ - 404 - -1 idrac_gather_facts_uri_return_content: true - diff_data: {} - exclude_keys: [] tasks: + - name: Collecting PCIeSSDBackPlane information from API + ansible.builtin.uri: + url: "https://{{ hostname }}/redfish/v1/Chassis/Oem/Dell/DellPCIeSSDBackPlanes" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + method: "{{ idrac_gather_facts_uri_method }}" + user: "{{ username }}" + password: "{{ password }}" + headers: "{{ idrac_gather_facts_uri_headers }}" + body_format: "{{ idrac_gather_facts_uri_body_format }}" + status_code: "{{ idrac_gather_facts_uri_status_code }}" + return_content: "{{ idrac_gather_facts_uri_return_content }}" + register: backplane_result_url + no_log: true + + - name: Validate whether PCIeSSDBackPlane information exists + ansible.builtin.assert: + that: + - "{{ backplane_result_url.json.Members | length > 0 }}" + fail_msg: "PCIeSSDBackPlane information does not exist" + + - name: Set PCIeSSDBackPlane facts + ansible.builtin.set_fact: + api_response: "{{ backplane_result_url.json.Members | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type']) }}" + - name: Gather Facts for the PCIeSSDBackPlane component ansible.builtin.include_role: name: "idrac_gather_facts" - - name: Assert backplane dict for length + - name: Check whether output differs + ansible.builtin.set_fact: + result_diff: "{{ backplane | symmetric_difference(api_response) }}" + + - name: Assert the differences in List ansible.builtin.assert: + fail_msg: "The response from the role does not match" + success_msg: "The response from the role matches" that: - - "{{ backplane | length > 0 }}" - - - name: Call assertion - ansible.builtin.include_tasks: ../../tests/asserts/backplane_assert.yml - with_items: "{{ backplane }}" - loop_control: - loop_var: backplane_data - when: backplane | length > 0 + - "{{ (result_diff | length) == 0 }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/bios/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/bios/converge.yml index 491d49d42..6d8bf0b66 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/bios/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/bios/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - BIOS diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/controller/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/controller/converge.yml index e7059f6a7..8e6ade139 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/controller/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/controller/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Controller diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/default/converge.yml index 3d3f3ed1d..58d622a57 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/default/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/default/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - System @@ -68,10 +68,8 @@ - name: Response filter ansible.builtin.set_fact: api_response: - "{{ system_result.json | json_query(jquery) | combine(os_result.json.Attributes) | + "{{ system_result.json.Oem.Dell.DellSystem | combine(os_result.json.Attributes) | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type']) }}" - vars: - jquery: "Oem.Dell.DellSystem" - name: Set the keys diff ansible.builtin.set_fact: diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosure/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosure/converge.yml index f83d84ac7..c43f9390a 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosure/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosure/converge.yml @@ -4,9 +4,9 @@ connection: local gather_facts: true vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Enclosure diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosureemm/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosureemm/converge.yml index 9bddda5a7..e240180b1 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosureemm/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/enclosureemm/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - EnclosureEMM diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/fan/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/fan/converge.yml index bdd47a873..7b17ce7dd 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/fan/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/fan/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Fan diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/firmware/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/firmware/converge.yml index 88047ce5c..a1fa26117 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/firmware/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/firmware/converge.yml @@ -4,9 +4,9 @@ connection: local gather_facts: true vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Firmware diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/hostnic/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/hostnic/converge.yml index 1ab1f4911..c7dff509f 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/hostnic/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/hostnic/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - HostNIC diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/idrac/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/idrac/converge.yml index 2b8788274..19e8bf7f5 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/idrac/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/idrac/converge.yml @@ -4,9 +4,9 @@ connection: local gather_facts: true vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - IDRAC diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/license/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/license/converge.yml index b1fe0419b..8e5609448 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/license/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/license/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - License diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/memory/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/memory/converge.yml index 5a3909481..b21c6ecdc 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/memory/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/memory/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Memory diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/negative/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/negative/converge.yml index b191098a8..6062027e6 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/negative/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/negative/converge.yml @@ -8,8 +8,8 @@ name: idrac_gather_facts vars: hostname: "randomHostname" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false ignore_errors: true ignore_unreachable: true @@ -24,9 +24,9 @@ ansible.builtin.import_role: name: idrac_gather_facts vars: - hostname: "{{ lookup('env', 'hostname') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" username: "randomUsername" - password: "{{ lookup('env', 'password') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: ["Bios"] ignore_errors: true @@ -42,8 +42,8 @@ ansible.builtin.import_role: name: idrac_gather_facts vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "randomPassword" validate_certs: false target: ["Bios"] @@ -56,30 +56,35 @@ that: - idrac_gather_facts_connection.status == -1 + - name: Set computer system id + ansible.builtin.set_fact: + system_id: "randomSystemID" + - name: To check for wrong system id ansible.builtin.import_role: name: idrac_gather_facts vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false - computer_system_id: "randomSystemID" + computer_system_id: "{{ system_id }}" ignore_errors: true register: idrac_gather_facts_error - name: Asserting after performing operation with invalid system id ansible.builtin.assert: that: - - "{{ computer_system_id not in system_ids }}" + - "{{ computer_system_id is not in system_ids}}" + when: system_ids is defined - name: To check for wrong manager id ansible.builtin.import_role: name: idrac_gather_facts vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false manager_id: "randomManagerID" target: ["Firmware"] diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/nic/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/nic/converge.yml index 70d00f200..c12fee4af 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/nic/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/nic/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - NIC diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml index 93de081d3..c4d86a62b 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - PresenceAndStatusSensor diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/pciedevice/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/pciedevice/converge.yml index b87459d13..924a8fd39 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/pciedevice/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/pciedevice/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - PCIeDevice diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml index a5b66a7f9..ef2414535 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - PhysicalDisk @@ -27,18 +27,60 @@ api_system: "/redfish/v1/Systems/System.Embedded.1" tasks: + - name: Get Storage information. + ansible.builtin.uri: &uri_params + url: "https://{{ hostname }}{{ api_system }}/Storage" + validate_certs: "{{ validate_certs }}" + ca_path: "{{ ca_path | default(omit) }}" + method: "{{ idrac_gather_facts_uri_method }}" + user: "{{ username }}" + password: "{{ password }}" + headers: "{{ idrac_gather_facts_uri_headers }}" + body_format: "{{ idrac_gather_facts_uri_body_format }}" + status_code: "{{ idrac_gather_facts_uri_status_code }}" + return_content: "{{ idrac_gather_facts_uri_return_content }}" + register: idrac_gather_facts_controllers_result + + - name: Get all storage controller ids. + ansible.builtin.set_fact: + storage_ids_list: "{{ idrac_gather_facts_controllers_result.json.Members | map('dict2items') | flatten | map(attribute='value') }}" + + - name: Get physical disk information using API. + ansible.builtin.uri: + url: "https://{{ hostname }}{{ item }}?$expand=*($levels=1)" + <<: *uri_params + loop: "{{ storage_ids_list }}" + no_log: true + register: idrac_gather_facts_disk_result + + - name: Count the number of drives in drives_result.results + ansible.builtin.set_fact: + drives_count: "{{ idrac_gather_facts_disk_result.results | map(attribute='json.drives') | list | length }}" + + - name: Validate whether physical disk information exists + ansible.builtin.assert: + that: + - "{{ drives_count | int > 0 }}" + fail_msg: "Physical Disk information does not exist" + + - name: Set Physical Disk facts + ansible.builtin.set_fact: + api_response: + "{{ disk_result.results | selectattr('json', 'defined') | map(attribute='json') | selectattr('Drives', 'defined') | + map(attribute='Drives') | flatten | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type', + 'Actions', 'Assembly', 'Links', 'DellDriveSMARTAttributes', 'DellNVMeSMARTAttributes', 'Operations@odata.count']) }}" + - name: Gather Facts for the Physical Disk component ansible.builtin.include_role: name: "idrac_gather_facts" - - name: Assert physical disk dict for length + - name: Check whether output differs + ansible.builtin.set_fact: + result_diff: "{{ physical_disk | symmetric_difference(api_response) }}" + + - name: Assert the differences in List ansible.builtin.assert: + fail_msg: "The response from the role does not match" + success_msg: "The response from the role matches" that: - - "{{ physical_disk | length > 0 }}" - - - name: Call assertion - ansible.builtin.include_tasks: ../../tests/asserts/physicaldisk_assert.yml - with_items: "{{ physical_disk }}" - loop_control: - loop_var: pd_data - when: physical_disk | length > 0 + - "{{ (result_diff | length) == 0 }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml index 1fdb5a278..0f648b875 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - PowerSupply diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/secureboot/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/secureboot/converge.yml index e4585165e..88fdc4ea6 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/secureboot/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/secureboot/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - SecureBoot diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsbattery/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsbattery/converge.yml index feee7473e..ab19c7cd2 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsbattery/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsbattery/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Sensors_Battery diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsintrusion/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsintrusion/converge.yml index 274319cff..4fca00ba1 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsintrusion/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsintrusion/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Sensors_Intrusion diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsvoltage/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsvoltage/converge.yml index 16435ef11..378022256 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsvoltage/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/sensorsvoltage/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - Sensors_Voltage diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml index acd31a108..418aa2b78 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - SystemMetrics @@ -88,13 +88,9 @@ register: response_power_supply no_log: true - - name: Set query - ansible.builtin.set_fact: - jq: "[*].Id" - - name: Get Power Supply Metrics ids ansible.builtin.set_fact: - psu_ids: "{{ power_result.json.Members | json_query(jq) }}" + psu_ids: "{{ power_result.json.Members | map(attribute='Id') | list }}" - name: Call assertion for Power metrics ansible.builtin.include_tasks: ../../tests/asserts/psmetrics_assert.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/virtualdisk/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/virtualdisk/converge.yml index 27fd2b829..5c3486634 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/virtualdisk/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/virtualdisk/converge.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: false vars: - hostname: "{{ lookup('env', 'hostname') }}" - username: "{{ lookup('env', 'username') }}" - password: "{{ lookup('env', 'password') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - VirtualDisk diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/backplane_assert.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/backplane_assert.yml deleted file mode 100644 index a4562f9e0..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/backplane_assert.yml +++ /dev/null @@ -1,39 +0,0 @@ -- name: Get PCIeSSDBackPlanes information. - ansible.builtin.uri: - url: "https://{{ hostname }}/redfish/v1/Chassis/Oem/Dell/DellPCIeSSDBackPlanes/{{ backplane_data.Id }}" - validate_certs: "{{ validate_certs }}" - ca_path: "{{ ca_path | default(omit) }}" - method: "{{ idrac_gather_facts_uri_method }}" - user: "{{ username }}" - password: "{{ password }}" - headers: "{{ idrac_gather_facts_uri_headers }}" - body_format: "{{ idrac_gather_facts_uri_body_format }}" - status_code: "{{ idrac_gather_facts_uri_status_code }}" - return_content: "{{ idrac_gather_facts_uri_return_content }}" - register: backplane_result - no_log: true - -- name: Set backplane facts - ansible.builtin.set_fact: - api_response: "{{ backplane_result.json | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type']) }}" - -- name: Set the keys diff - ansible.builtin.set_fact: - diff_keys: "{{ backplane_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}" - -- name: Set a Diff of dict - ansible.builtin.set_fact: - diff_data: "{{ diff_data | combine({item: backplane_data[item]}) }}" - loop: "{{ backplane_data.keys() }}" - when: - - diff_keys | length == 0 - - backplane_data[item] != api_response[item] - - item not in exclude_keys - -- name: Assert the difference in Keys - ansible.builtin.assert: - that: - - "{{ (diff_keys | length) == 0 }}" - - "{{ (diff_data | length) == 0 }}" - fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}" - success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/physicaldisk_assert.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/physicaldisk_assert.yml deleted file mode 100644 index 76ec6624f..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/physicaldisk_assert.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- -- name: Get controller id - ansible.builtin.set_fact: - ctrl_id: "{{ pd_data.Id | split(':') | last }}" - -- name: Get Storage information. - ansible.builtin.uri: - url: "https://{{ hostname }}{{ api_system }}/Storage/{{ ctrl_id }}/Drives/{{ pd_data.Id }}" - validate_certs: "{{ validate_certs }}" - ca_path: "{{ ca_path | default(omit) }}" - method: "{{ idrac_gather_facts_uri_method }}" - user: "{{ username }}" - password: "{{ password }}" - headers: "{{ idrac_gather_facts_uri_headers }}" - body_format: "{{ idrac_gather_facts_uri_body_format }}" - status_code: "{{ idrac_gather_facts_uri_status_code }}" - return_content: "{{ idrac_gather_facts_uri_return_content }}" - no_log: true - register: disk_result - -- name: Filter Physical Disk data - ansible.builtin.set_fact: - api_response: "{{ disk_result.json | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type', - 'Actions', 'Assembly', 'Links', 'DellDriveSMARTAttributes', 'DellNVMeSMARTAttributes', 'Operations@odata.count']) }}" - -- name: Set the keys diff - ansible.builtin.set_fact: - diff_keys: "{{ pd_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}" - -- name: Set a Diff of dict - ansible.builtin.set_fact: - diff_data: "{{ diff_data | combine({item: pd_data[item]}) }}" - loop: "{{ pd_data.keys() }}" - when: - - diff_keys | length == 0 - - pd_data[item] != api_response[item] - - item not in exclude_keys - -- name: Assert the difference in Keys - ansible.builtin.assert: - that: - - "{{ (diff_keys | length) == 0 }}" - - "{{ (diff_data | length) == 0 }}" - fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}" - success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/converge.yml index 29ff66275..df421143f 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/converge.yml @@ -1,21 +1,32 @@ --- - name: Converge hosts: all + vars: + share_input: &share_input + share_name: "{{ lookup('env', 'cifs_url') }}" + share_user: "{{ lookup('env', 'cifs_username') }}" + share_password: "{{ lookup('env', 'cifs_password') }}" + scp_file: "{{ lookup('env', 'cifs_filename') }}" gather_facts: false tasks: + - name: "Pre-requisites" + ansible.builtin.include_tasks: + file: "../resources/tests/export.yml" + vars: + _share_parameters: + <<: *share_input + tags: molecule-idempotence-notest + - name: "Importing SCP from CIFS with ALL components" ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'CIFS_URL') }}" - share_user: "{{ lookup('env', 'CIFS_USERNAME') }}" - share_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" - scp_file: "{{ lookup('env', 'cifs_filename') }}" + <<: *share_input - name: Verifying Import SCP from CIFS with ALL components ansible.builtin.assert: diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/molecule.yml index e69de29bb..fc17009ba 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/molecule.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/tests/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/cifs_share/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/default/converge.yml index c0ae89edf..46f902d78 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/default/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/default/converge.yml @@ -7,14 +7,14 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: ['IDRAC'] share_parameters: - share_user: "{{ lookup('env', 'USERNAME') }}" - share_password: "{{ lookup('env', 'PASSWORD') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" scp_file: "{{ lookup('env', 'http_filename') }}" ignore_errors: true register: idrac_import_server_config_profile_status @@ -28,15 +28,15 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: ['IDRAC'] share_parameters: - share_name: "{{ lookup('env', 'HTTP_URL') }}" - share_user: "{{ lookup('env', 'USERNAME') }}" - share_password: "{{ lookup('env', 'PASSWORD') }}" + share_name: "{{ lookup('env', 'http_url') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" ignore_errors: true register: idrac_import_server_config_profile_status @@ -50,14 +50,14 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'CIFS_URL') }}" - share_user: "{{ lookup('env', 'CIFS_USERNAME') }}" - share_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + share_name: "{{ lookup('env', 'cifs_url') }}" + share_user: "{{ lookup('env', 'cifs_username') }}" + share_password: "{{ lookup('env', 'cifs_password') }}" scp_file: "invalid_file.xml" ignore_errors: true register: idrac_import_server_config_profile_status @@ -76,14 +76,14 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: share_name: "192.168.0.1:/cifsshare" - share_user: "{{ lookup('env', 'CIFS_USERNAME') }}" - share_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + share_user: "{{ lookup('env', 'cifs_username') }}" + share_password: "{{ lookup('env', 'cifs_password') }}" scp_file: "{{ lookup('env', 'cifs_filename') }}" ignore_errors: true register: idrac_import_server_config_profile_status @@ -99,13 +99,13 @@ name: "idrac_import_server_config_profile" vars: hostname: "randomHostname" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'CIFS_URL') }}" - share_user: "{{ lookup('env', 'CIFS_USERNAME') }}" - share_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + share_name: "{{ lookup('env', 'cifs_url') }}" + share_user: "{{ lookup('env', 'cifs_username') }}" + share_password: "{{ lookup('env', 'cifs_password') }}" scp_file: "{{ lookup('env', 'cifs_filename') }}" ignore_errors: true ignore_unreachable: true @@ -121,14 +121,14 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" username: "WrongUsername123" - password: "{{ lookup('env', 'PASSWORD') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'CIFS_URL') }}" - share_user: "{{ lookup('env', 'CIFS_USERNAME') }}" - share_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + share_name: "{{ lookup('env', 'cifs_url') }}" + share_user: "{{ lookup('env', 'cifs_username') }}" + share_password: "{{ lookup('env', 'cifs_password') }}" scp_file: "{{ lookup('env', 'cifs_filename') }}" ignore_errors: true ignore_unreachable: true @@ -143,14 +143,14 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "WrongPassword@123" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'CIFS_URL') }}" - share_user: "{{ lookup('env', 'CIFS_USERNAME') }}" - share_password: "{{ lookup('env', 'CIFS_PASSWORD') }}" + share_name: "{{ lookup('env', 'cifs_url') }}" + share_user: "{{ lookup('env', 'cifs_username') }}" + share_password: "{{ lookup('env', 'cifs_password') }}" scp_file: "{{ lookup('env', 'cifs_filename') }}" ignore_errors: true ignore_unreachable: true @@ -165,15 +165,15 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: ['idrac'] share_parameters: - share_name: "{{ lookup('env', 'HTTP_URL') }}" - share_user: "{{ lookup('env', 'HTTP_USERNAME') }}" - share_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" + share_name: "{{ lookup('env', 'http_url') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" scp_file: "{{ lookup('env', 'http_filename') }}" ignore_errors: true register: idrac_import_server_config_profile_status @@ -188,15 +188,15 @@ # ansible.builtin.import_role: # name: "idrac_import_server_config_profile" # vars: - # hostname: "{{ lookup('env', 'HOSTNAME') }}" - # username: "{{ lookup('env', 'USERNAME') }}" - # password: "{{ lookup('env', 'PASSWORD') }}" + # hostname: "{{ lookup('env', 'IDRAC_IP') }}" + # username: "{{ lookup('env', 'IDRAC_USER') }}" + # password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" # validate_certs: false # target: ['IDRAC'] # share_parameters: - # share_name: "{{ lookup('env', 'HTTP_URL') }}" + # share_name: "{{ lookup('env', 'http_url') }}" # share_user: "WrongUsername123" - # share_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" + # share_password: "{{ lookup('env', 'http_password') }}" # scp_file: "{{ lookup('env', 'http_filename') }}" # ignore_errors: true # register: idrac_import_server_config_profile_status @@ -217,14 +217,14 @@ # ansible.builtin.import_role: # name: "idrac_import_server_config_profile" # vars: - # hostname: "{{ lookup('env', 'HOSTNAME') }}" - # username: "{{ lookup('env', 'USERNAME') }}" - # password: "{{ lookup('env', 'PASSWORD') }}" + # hostname: "{{ lookup('env', 'IDRAC_IP') }}" + # username: "{{ lookup('env', 'IDRAC_USER') }}" + # password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" # validate_certs: false # target: ['IDRAC'] # share_parameters: - # share_name: "{{ lookup('env', 'HTTP_URL') }}" - # share_user: "{{ lookup('env', 'USERNAME') }}" + # share_name: "{{ lookup('env', 'http_url') }}" + # share_user: "{{ lookup('env', 'http_username') }}" # share_password: "WrongPassword@123" # scp_file: "{{ lookup('env', 'http_filename') }}" # ignore_errors: true @@ -241,14 +241,14 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: ['IDRAC'] share_parameters: share_name: None - share_user: "{{ lookup('env', 'USERNAME') }}" + share_user: "{{ lookup('env', 'http_username') }}" share_password: "WrongPassword@123" scp_file: "{{ lookup('env', 'http_filename') }}" ignore_errors: true @@ -263,15 +263,15 @@ ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: ['ALL'] share_parameters: - share_name: "{{ lookup('env', 'HTTP_URL') }}" - share_user: "{{ lookup('env', 'HTTP_USERNAME') }}" - share_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" + share_name: "{{ lookup('env', 'http_url') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" scp_file: "{{ lookup('env', 'http_filename') }}" proxy_support: true ignore_errors: true @@ -287,21 +287,21 @@ # ansible.builtin.import_role: # name: "idrac_import_server_config_profile" # vars: - # hostname: "{{ lookup('env', 'HOSTNAME') }}" - # username: "{{ lookup('env', 'USERNAME') }}" - # password: "{{ lookup('env', 'PASSWORD') }}" + # hostname: "{{ lookup('env', 'IDRAC_IP') }}" + # username: "{{ lookup('env', 'IDRAC_USER') }}" + # password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" # validate_certs: false # target: ['ALL'] # share_parameters: - # share_name: "{{ lookup('env', 'HTTP_URL') }}" - # share_user: "{{ lookup('env', 'HTTP_USERNAME') }}" - # share_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" + # share_name: "{{ lookup('env', 'http_url') }}" + # share_user: "{{ lookup('env', 'http_username') }}" + # share_password: "{{ lookup('env', 'http_password') }}" # scp_file: "{{ lookup('env', 'http_filename') }}" # proxy_support: true # proxy_type: http # proxy_server: "randomProxyServer" - # proxy_port: "{{ lookup('env', 'PROXY_PORT') }}" - # proxy_password: "{{ lookup('env', 'PROXY_PASSWORD') }}" + # proxy_port: "{{ lookup('env', 'proxy_port') }}" + # proxy_password: "{{ lookup('env', 'proxy_password') }}" # ignore_errors: true # register: idrac_import_server_config_profile_status diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/converge.yml index f9761ebc1..6ab64e12b 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/converge.yml @@ -1,23 +1,33 @@ --- - name: Converge hosts: all + vars: + share_input: &share_input + share_name: "{{ lookup('env', 'http_url') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" + scp_file: "{{ lookup('env', 'http_filename') }}" gather_facts: false tasks: + - name: "Pre-requisites" + ansible.builtin.include_tasks: + file: "../resources/tests/export.yml" + vars: + _share_parameters: + <<: *share_input + tags: molecule-idempotence-notest - name: "Importing SCP from HTTPS" ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: "RAID" share_parameters: - share_name: "{{ lookup('env', 'HTTP_URL') }}" - share_user: "{{ lookup('env', 'HTTP_USERNAME') }}" - share_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" - scp_file: "{{ lookup('env', 'http_filename') }}" + <<: *share_input when: not ansible_check_mode - name: Verifying Import SCP from HTTP with in normal mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/molecule.yml index e69de29bb..fc17009ba 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/molecule.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/tests/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/converge.yml index a0348544a..71d891f10 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/converge.yml @@ -1,27 +1,38 @@ --- - name: Converge hosts: all + vars: + share_input: &share_input + share_name: "{{ lookup('env', 'http_url') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" + scp_file: "{{ lookup('env', 'http_filename') }}" + proxy_support: true + proxy_type: http + proxy_server: "{{ lookup('env', 'proxy_server') }}" + proxy_username: "{{ lookup('env', 'proxy_username') }}" + proxy_port: "{{ lookup('env', 'proxy_port') }}" + proxy_password: "{{ lookup('env', 'proxy_password') }}" gather_facts: false tasks: + - name: "Pre-requisites" + ansible.builtin.include_tasks: + file: "../resources/tests/export.yml" + vars: + _share_parameters: + <<: *share_input + tags: molecule-idempotence-notest + - name: "Importing SCP from HTTP with proxy parameters" ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'HTTP_URL') }}" - share_user: "{{ lookup('env', 'HTTP_USERNAME') }}" - share_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" - scp_file: "{{ lookup('env', 'http_filename') }}" - proxy_support: true - proxy_type: http - proxy_server: "{{ lookup('env', 'PROXY_SERVER') }}" - proxy_port: "{{ lookup('env', 'PROXY_PORT') }}" - proxy_username: "{{ lookup('env', 'PROXY_USER') }}" - proxy_password: "{{ lookup('env', 'PROXY_PASSWORD') }}" + <<: *share_input when: not ansible_check_mode - name: Verifying Import SCP from HTTP with proxy parameters in normal mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/molecule.yml index e69de29bb..fc17009ba 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/molecule.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/tests/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_proxy_parameters/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_showerror_certificate_warning/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_showerror_certificate_warning/converge.yml index b96730d75..f49f28438 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_showerror_certificate_warning/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_showerror_certificate_warning/converge.yml @@ -2,26 +2,37 @@ - name: Converge hosts: all gather_facts: false + vars: + share_input: &share_input + share_name: "{{ lookup('env', 'http_url') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" + scp_file: "{{ lookup('env', 'http_filename') }}" + proxy_support: true + proxy_server: "{{ lookup('env', 'proxy_server') }}" + proxy_username: "{{ lookup('env', 'proxy_username') }}" + proxy_port: "{{ lookup('env', 'proxy_port') }}" + proxy_password: "{{ lookup('env', 'proxy_password') }}" + ignore_certificate_warning: showerror tasks: + - name: "Pre-requisites" + ansible.builtin.include_tasks: + file: "../resources/tests/export.yml" + vars: + _share_parameters: + <<: *share_input + tags: molecule-idempotence-notest + - name: "Importing SCP from HTTPS with ignore_certificate_warning as showerror" ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'HTTP_URL') }}" - share_user: "{{ lookup('env', 'HTTP_USERNAME') }}" - share_password: "{{ lookup('env', 'HTTP_PASSWORD') }}" - scp_file: "{{ lookup('env', 'http_filename') }}" - proxy_support: true - proxy_server: "{{ lookup('env', 'PROXY_SERVER') }}" - proxy_port: "{{ lookup('env', 'PROXY_PORT') }}" - proxy_username: "{{ lookup('env', 'PROXY_USER') }}" - proxy_password: "{{ lookup('env', 'PROXY_PASSWORD') }}" - ignore_certificate_warning: showerror + <<: *share_input when: not ansible_check_mode - name: Verifying Import SCP from HTTP with ignore_certificate_warning as showerror in normal mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_showerror_certificate_warning/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_showerror_certificate_warning/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/http_share_with_showerror_certificate_warning/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/converge.yml index 7981a536c..cb61a0947 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/converge.yml @@ -1,21 +1,32 @@ --- - name: Converge hosts: all + vars: + share_input: &share_input + share_name: "{{ lookup('env', 'https_url') }}" + share_user: "{{ lookup('env', 'http_username') }}" + share_password: "{{ lookup('env', 'http_password') }}" + scp_file: "{{ lookup('env', 'https_filename') }}" gather_facts: false tasks: + - name: "Pre-requisites" + ansible.builtin.include_tasks: + file: "../resources/tests/export.yml" + vars: + _share_parameters: + <<: *share_input + tags: molecule-idempotence-notest + - name: "Importing SCP from HTTPS" ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'HTTPS_URL') }}" - share_user: "{{ lookup('env', 'HTTPS_USERNAME') }}" - share_password: "{{ lookup('env', 'HTTPS_PASSWORD') }}" - scp_file: "{{ lookup('env', 'https_filename') }}" + <<: *share_input when: not ansible_check_mode - name: Verifying Import SCP from HTTPS in normal mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/molecule.yml index e69de29bb..fc17009ba 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/molecule.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/tests/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/converge.yml index 013505814..2f10bff1f 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/converge.yml @@ -1,27 +1,38 @@ --- - name: Converge hosts: all + vars: + share_input: &share_input + share_name: "{{ lookup('env', 'https_url') }}" + share_user: "{{ lookup('env', 'https_username') }}" + share_password: "{{ lookup('env', 'https_password') }}" + scp_file: "{{ lookup('env', 'https_filename') }}" + proxy_support: true + proxy_type: http + proxy_server: "{{ lookup('env', 'proxy_server') }}" + proxy_username: "{{ lookup('env', 'proxy_username') }}" + proxy_port: "{{ lookup('env', 'proxy_port') }}" + proxy_password: "{{ lookup('env', 'proxy_password') }}" gather_facts: false tasks: + - name: "Pre-requisites" + ansible.builtin.include_tasks: + file: "../resources/tests/export.yml" + vars: + _share_parameters: + <<: *share_input + tags: molecule-idempotence-notest + - name: "Importing SCP from HTTPS with proxy parameters" ansible.builtin.import_role: name: "idrac_import_server_config_profile" vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'HTTPS_URL') }}" - share_user: "{{ lookup('env', 'HTTPS_USERNAME') }}" - share_password: "{{ lookup('env', 'HTTPS_PASSWORD') }}" - scp_file: "{{ lookup('env', 'https_filename') }}" - proxy_support: true - proxy_type: http - proxy_server: "{{ lookup('env', 'PROXY_SERVER') }}" - proxy_username: "{{ lookup('env', 'PROXY_USER') }}" - proxy_port: "{{ lookup('env', 'PROXY_PORT') }}" - proxy_password: "{{ lookup('env', 'PROXY_PASSWORD') }}" + <<: *share_input when: not ansible_check_mode - name: Verifying Import SCP from HTTPS with proxy parameters in normal mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/molecule.yml index e69de29bb..fc17009ba 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/molecule.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/tests/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/https_share_with_proxy_parameters/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_json/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_json/converge.yml index 3fbeec584..bbc8161cf 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_json/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_json/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: idrac_import_server_config_profile vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: - IDRAC diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_xml/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_xml/converge.yml index bd956dc0c..3f7ef166a 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_xml/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_buffer_xml/converge.yml @@ -7,9 +7,9 @@ ansible.builtin.import_role: name: idrac_import_server_config_profile vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false target: ['IDRAC'] import_buffer: '<SystemConfiguration><Component FQDD="iDRAC.Embedded.1"><Attribute Name="Time.1#Timezone">CST6CDT</Attribute> diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/converge.yml index 860e63b52..4e130f66a 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/converge.yml @@ -1,23 +1,24 @@ --- - name: Converge hosts: all + vars: + _target: ['NIC', 'IDRAC'] + share_input: &share_input + share_name: "{{ lookup('env', 'nfs_url') }}" + scp_file: "{{ lookup('env', 'nfs_filename') }}" gather_facts: false tasks: - - name: "Importing SCP from NFS with multiple components" ansible.builtin.import_role: name: idrac_import_server_config_profile vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false - target: - - 'NIC' - - 'IDRAC' + target: "{{ _target }}" share_parameters: - share_name: "{{ lookup('env', 'NFS_URL') }}" - scp_file: "{{ lookup('env', 'nfs_filename') }}" + <<: *share_input shutdown_type: 'Forced' end_host_power_state: 'On' when: not ansible_check_mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/molecule.yml index e69de29bb..fc17009ba 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/molecule.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/tests/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/import_multiple_target/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/converge.yml index bb839b38b..14d3de043 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/converge.yml @@ -1,20 +1,30 @@ --- - name: Converge hosts: all + vars: + share_input: &share_input + share_name: "{{ lookup('env', 'nfs_url') }}" + scp_file: "{{ lookup('env', 'nfs_filename') }}" gather_facts: false tasks: + - name: "Pre-requisites" + ansible.builtin.include_tasks: + file: "../resources/tests/export.yml" + vars: + _share_parameters: + <<: *share_input + tags: molecule-idempotence-notest - name: "Importing SCP from NFS" ansible.builtin.import_role: name: idrac_import_server_config_profile vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false share_parameters: - share_name: "{{ lookup('env', 'NFS_URL') }}" - scp_file: "{{ lookup('env', 'nfs_filename') }}" + <<: *share_input shutdown_type: 'Forced' end_host_power_state: 'On' when: not ansible_check_mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/molecule.yml index e69de29bb..fc17009ba 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/molecule.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/tests/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/prepare.yml deleted file mode 100644 index 5fadc24b5..000000000 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/nfs_share/prepare.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Cleanup - hosts: all - gather_facts: false - tasks: - - name: Cleanup config - ansible.builtin.include_tasks: ../resources/tests/prepare.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/cleanup.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/cleanup.yml new file mode 100644 index 000000000..1cb9a04de --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/cleanup.yml @@ -0,0 +1,64 @@ +--- +- name: Cleanup + hosts: all + gather_facts: false + tasks: + - name: Setfact for target + ansible.builtin.set_fact: + idrac_import_server_config_profile_target: "{{ idrac_import_server_config_profile_target | default(['ALL']) }}" + + - name: Cleanup when target is ['ALL'] or ['IDRAC'] + ansible.builtin.import_role: + name: idrac_attributes + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + idrac_attributes: + Time.1.Timezone: "UTC" # "UTC" + when: "'ALL' in idrac_import_server_config_profile_target or 'IDRAC' in idrac_import_server_config_profile_target" + + - name: Cleanup when target is ['BIOS'] + dellemc.openmanage.idrac_bios: + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + attributes: + NumLock: "On" # "On" + when: "'BIOS' in idrac_import_server_config_profile_target" + + - name: Calling nic_helper.yml + ansible.builtin.include_tasks: + file: "nic_helper.yml" + when: "'NIC' in idrac_import_server_config_profile_target" + + - name: Cleanup when target is ['NIC'] + dellemc.openmanage.idrac_network_attributes: + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + network_adapter_id: "{{ inp_network_adapter_id }}" + network_device_function_id: "{{ inp_network_device_function_id }}" + apply_time: Immediate + oem_network_attributes: + BannerMessageTimeout: "5" # "5" + when: "'NIC' in idrac_import_server_config_profile_target" + + - name: Calling raid_helper.yml + ansible.builtin.include_tasks: + file: "raid_helper.yml" + when: "'RAID' in idrac_import_server_config_profile_target" + + - name: Cleanup when target is ['RAID'] + dellemc.openmanage.idrac_redfish_storage_controller: + baseuri: "{{ lookup('env', 'IDRAC_IP') }}:{{ https_port }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + controller_id: "{{ inp_controller_id }}" + attributes: + SupportedInitializationTypes: "Fast" + when: "'RAID' in idrac_import_server_config_profile_target" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/export.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/export.yml new file mode 100644 index 000000000..f0b8d9024 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/export.yml @@ -0,0 +1,72 @@ +--- +- name: Setfact for target + ansible.builtin.set_fact: + idrac_import_server_config_profile_target: "{{ idrac_import_server_config_profile_target | default(['ALL']) }}" + +- name: Performing export of server config profile + ansible.builtin.import_role: + name: idrac_export_server_config_profile + vars: + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + target: "{{ idrac_import_server_config_profile_target }}" + share_parameters: "{{ _share_parameters }}" + when: _share_parameters is defined + +- name: Making changes when target is ['ALL'] or ['IDRAC'] + ansible.builtin.import_role: + name: idrac_attributes + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + idrac_attributes: + Time.1.Timezone: "CST6CDT" + when: "'ALL' in idrac_import_server_config_profile_target or 'IDRAC' in idrac_import_server_config_profile_target" + +- name: Making changes when target is ['BIOS'] + dellemc.openmanage.idrac_bios: + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + attributes: + NumLock: "Off" + when: "'BIOS' in idrac_import_server_config_profile_target" + +- name: Calling nic_helper.yml + ansible.builtin.include_tasks: + file: "nic_helper.yml" + when: "'NIC' in idrac_import_server_config_profile_target" + +- name: Making changes when target is ['NIC'] + dellemc.openmanage.idrac_network_attributes: + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + network_adapter_id: "{{ inp_network_adapter_id }}" + network_device_function_id: "{{ inp_network_device_function_id }}" + apply_time: Immediate + oem_network_attributes: + BannerMessageTimeout: "4" + when: "'NIC' in idrac_import_server_config_profile_target" + +- name: Calling raid_helper.yml + ansible.builtin.include_tasks: + file: "raid_helper.yml" + when: "'RAID' in idrac_import_server_config_profile_target" + +- name: Making changes when target is ['RAID'] + dellemc.openmanage.idrac_redfish_storage_controller: + baseuri: "{{ lookup('env', 'IDRAC_IP') }}:{{ https_port }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + controller_id: "{{ inp_controller_id }}" + attributes: + SupportedInitializationTypes: "Slow" + when: "'RAID' in idrac_import_server_config_profile_target" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/nic_helper.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/nic_helper.yml new file mode 100644 index 000000000..a8211d70a --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/nic_helper.yml @@ -0,0 +1,39 @@ +- name: Helper file for NIC + block: + - name: Fetch network adapter id + ansible.builtin.uri: &network_uri + url: "https://{{ idrac_ip | ansible.utils.ipwrap }}:{{ idrac_port }}/redfish/v1/Systems/System.Embedded.1/NetworkAdapters" + user: "{{ idrac_user }}" + password: "{{ idrac_password }}" + method: GET + body: {} + validate_certs: false + body_format: json + return_content: true + status_code: 200 + headers: 'Accept=application/json' + force_basic_auth: true + register: fetched_network_adapter_id + + - name: Extracting network adapter id + ansible.builtin.set_fact: + network_adapter_id: "{{ fetched_network_adapter_id.content | from_json | json_query('Members[0]') }}" + + - name: Setting network adapter id + ansible.builtin.set_fact: + inp_network_adapter_id: "{{ '@odata.id' | extract(network_adapter_id) | split('/') | last }}" + + - name: Fetch network device function id + ansible.builtin.uri: + <<: *network_uri + url: "https://{{ idrac_ip | ansible.utils.ipwrap }}:{{ idrac_port }}/redfish/v1/Systems\ + /System.Embedded.1/NetworkAdapters/{{ inp_network_adapter_id }}/NetworkDeviceFunctions" + register: fetched_network_device_function_id + + - name: Extracting network device function id + ansible.builtin.set_fact: + network_device_function_id: "{{ fetched_network_device_function_id.content | from_json | json_query('Members[0]') }}" + + - name: Setting network device function id + ansible.builtin.set_fact: + inp_network_device_function_id: "{{ '@odata.id' | extract(network_device_function_id) | split('/') | last }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/prepare.yml index aa9fd74c5..b73bedd59 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/prepare.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/prepare.yml @@ -3,9 +3,9 @@ ansible.builtin.import_role: name: idrac_import_server_config_profile vars: - hostname: "{{ lookup('env', 'HOSTNAME') }}" - username: "{{ lookup('env', 'USERNAME') }}" - password: "{{ lookup('env', 'PASSWORD') }}" + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false import_buffer: "{ \"SystemConfiguration\": {\"Components\": [ { \"FQDD\": \"iDRAC.Embedded.1\",\"Attributes\": [{ \"Name\": \"Time.1#Timezone\", diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/raid_helper.yml b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/raid_helper.yml new file mode 100644 index 000000000..42d0ff214 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_import_server_config_profile/molecule/resources/tests/raid_helper.yml @@ -0,0 +1,24 @@ +- name: Helper file for RAID + block: + - name: Fetch storage controller id + ansible.builtin.uri: &network_uri + url: "https://{{ idrac_ip | ansible.utils.ipwrap }}:{{ idrac_port }}/redfish/v1/Systems/System.Embedded.1/Storage" + user: "{{ idrac_user }}" + password: "{{ idrac_password }}" + method: GET + body: {} + validate_certs: false + body_format: json + return_content: true + status_code: 200 + headers: 'Accept=application/json' + force_basic_auth: true + register: fetched_controller_id + + - name: Extracting controller id + ansible.builtin.set_fact: + controller_id: "{{ fetched_controller_id.content | from_json | json_query('Members[0]') }}" + + - name: Setting controller id + ansible.builtin.set_fact: + inp_controller_id: "{{ '@odata.id' | extract(controller_id) | split('/') | last }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/clear_job_queue/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/clear_job_queue/converge.yml index 6bf6af48b..cc9f08965 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/clear_job_queue/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/clear_job_queue/converge.yml @@ -7,7 +7,7 @@ ansible.builtin.set_fact: input: &input hostname: "{{ lookup('env', 'IDRAC_IP') }}" - username: "{{ lookup('env', 'IDRAC_USERNAME') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false no_log: true @@ -83,7 +83,7 @@ - name: Creating a job which exports SCP local path with all components dellemc.openmanage.idrac_server_config_profile: idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" - idrac_user: "{{ lookup('env', 'IDRAC_USERNAME') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false scp_components: diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml index 1d14502f8..2c16c6319 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml @@ -6,7 +6,7 @@ - name: Creating job to export SCP local path with all components dellemc.openmanage.idrac_server_config_profile: idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" - idrac_user: "{{ lookup('env', 'IDRAC_USERNAME') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}" scp_components: @@ -24,7 +24,7 @@ name: "idrac_job_queue" vars: hostname: "{{ lookup('env', 'IDRAC_IP') }}" - username: "{{ lookup('env', 'IDRAC_USERNAME') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}" job_id: JID_12345678 @@ -41,7 +41,7 @@ name: idrac_job_queue vars: hostname: "invalidHostname" - username: "{{ lookup('env', 'IDRAC_USERNAME') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" clear_job_queue: true validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}" @@ -78,7 +78,7 @@ name: idrac_job_queue vars: hostname: "{{ lookup('env', 'IDRAC_IP') }}" - username: "{{ lookup('env', 'IDRAC_USERNAME') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "invalidPassword" clear_job_queue: true validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml index ecf859bf7..809dda61f 100644 --- a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml @@ -7,7 +7,7 @@ ansible.builtin.set_fact: input: &input hostname: "{{ lookup('env', 'IDRAC_IP') }}" - username: "{{ lookup('env', 'IDRAC_USERNAME') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}" no_log: true @@ -37,7 +37,7 @@ - name: Creating job to export SCP local path with all components dellemc.openmanage.idrac_server_config_profile: idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" - idrac_user: "{{ lookup('env', 'IDRAC_USERNAME') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}" scp_components: @@ -55,7 +55,7 @@ url: "https://{{ lookup('env', 'IDRAC_IP') }}/redfish/v1/Managers/iDRAC.Embedded.1/Jobs" validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}" method: "GET" - user: "{{ lookup('env', 'IDRAC_USERNAME') }}" + user: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" headers: Accept: "application/json" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/README.md b/ansible_collections/dellemc/openmanage/roles/idrac_user/README.md new file mode 100644 index 000000000..0404dfe71 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/README.md @@ -0,0 +1,347 @@ +# idrac_user + +Role to manage local users for iDRAC. + +## 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>- IPv4, IPv6 Address or hostname of the iDRAC.</td> + </tr> + <tr> + <td>username</td> + <td>true</td> + <td></td> + <td></td> + <td>str</td> + <td>- iDRAC username with 'Administrator' privilege.</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>state</td> + <td>false</td> + <td>present</td> + <td>[present, absent]</td> + <td>str</td> + <td>- Select C(present) to create or modify a user account.</br>- Select C(absent) to remove a user account.</td> + </tr> + <tr> + <td>user_name</td> + <td>true</td> + <td></td> + <td></td> + <td>str</td> + <td>- Provide username of the iDRAC user account that is created, deleted, or modified.</td> + </tr> + <tr> + <td>user_password</td> + <td>false</td> + <td></td> + <td></td> + <td>str</td> + <td>- Provide password for the iDRAC user account that is created, or modified. The password can be changed when the user account is modified.</br>- To ensure security, the I(user_password) must be at least eight characters long and must contain + lowercase and upper-case characters, numbers, and special characters. +</td> + </tr> + <tr> + <td>new_user_name</td> + <td>false</td> + <td></td> + <td></td> + <td>str</td> + <td>- Provide the I(user_name) for the iDRAC user account that is modified.</td> + </tr> + <tr> + <td>privilege</td> + <td>false</td> + <td></td> + <td>["Administrator","ReadOnly","Operator","None"]</td> + <td>str</td> + <td>- Following are the role-based privileges.</br>- A user with C(Administrator) privilege can log in to iDRAC, and then configure iDRAC, configure users,clear logs, control and configure system, access virtual console, access virtual media, test alerts, and execute debug commands. + </br>- A user with C(Operator) privilege can log in to iDRAC, and then configure iDRAC, control and configure system, access virtual console, access virtual media, and execute debug commands.</br>- A user with C(ReadOnly) privilege can only log in to iDRAC.</br>- A user with C(None), no privileges assigned.</br>- Will be ignored, if I(custom_privilege) parameter is provided.</td> + </tr> + </tr> + <tr> + <td>custom_privilege</td> + <td>false</td> + <td></td> + <td></td> + <td>int</td> + <td>- Provide the custom role-based authority privileges allowed for the user.</br>- To create a custom privilege, add up the privilege decimal values as defined below.</br>Login - 1</br>Configure - 2</br>Configure Users - 4</br>Logs - 8</br>System Control - 16</br>Access Virtual Console - 32</br>Access Virtual Media - 64</br>System Operations - 128</br>Debug - 256</br>- The value has to be in the range 0-511.</td> + </tr> + <tr> + <td>ipmi_lan_privilege</td> + <td>false</td> + <td></td> + <td>["Administrator","ReadOnly","Operator","No Access"]</td> + <td>str</td> + <td>- The Intelligent Platform Management Interface LAN privilege level assigned to the user.</td> + </tr> + <tr> + <td>ipmi_serial_privilege</td> + <td>false</td> + <td></td> + <td>["Administrator","ReadOnly","Operator","No Access"]</td> + <td>str</td> + <td>- The Intelligent Platform Management Interface Serial Port privilege level assigned to the user.</br>- This option is only applicable for rack and tower servers.</td> + </tr> + <tr> + <td>enable</td> + <td>false</td> + <td></td> + <td></td> + <td>bool</td> + <td>Provide the option to enable or disable a user from logging in to iDRAC.</td> + </tr> + <tr> + <td>sol_enable</td> + <td>false</td> + <td></td> + <td></td> + <td>bool</td> + <td>Enables Serial Over Lan (SOL) for an iDRAC user.</td> + </tr> + <tr> + <td>protocol_enable</td> + <td>false</td> + <td></td> + <td></td> + <td>bool</td> + <td>Enables SNMPv3 protocol for the iDRAC user.</td> + </tr> + <tr> + <td>authentication_protocol</td> + <td>false</td> + <td></td> + <td>["None","SHA5","MD5"]</td> + <td>str</td> + <td>- This option allows to configure one of the following authentication protocol types to authenticate the iDRAC user.</br>- Secure Hash Algorithm C(SHA).</br>- Message Digest 5 C(MD5).</br>- If C(None) is selected, then the authentication protocol is not configured.</td> + </tr> + <tr> + <td>privacy_protocol</td> + <td>false</td> + <td></td> + <td>["None","DES","AES"]</td> + <td>str</td> + <td>- This option allows to configure one of the following privacy encryption protocols for the iDRAC user.</br>- Data Encryption Standard C(DES).</br>- Advanced Encryption Standard C(AES).</br>- If C(None) is selected, then the privacy protocol is not configured.</td> + </tr> + + +## Fact variables + +<table> +<thead> + <tr> + <th>Name</th> + <th>Sample</th> + <th>Description</th> + </tr> +</thead> + <tbody> + <tr> + <td>idrac_user_out</td> + <td>{"changed": true, + "failed": false, + "msg": "Successfully created user account details." +}</td> +<td>Output of the iDRAC user role</td> +</tr> +<tr> + <td>idrac_user_account</td> + <td> + {"changed": true, + "failed": false, + { + "AccountTypes": [ + "Redfish", + "SNMP", + "OEM", + "HostConsole", + "ManagerConsole", + "IPMI", + "KVMIP", + "VirtualMedia", + "WebUI" + ], + "Description": "User Account", + "Enabled": true, + "Id": "2", + "Locked": false, + "Name": "User Account", + "OEMAccountTypes": [ + "IPMI", + "SOL", + "WSMAN", + "UI", + "RACADM" + ], + "Oem": { + "Dell": { + "SNMPv3PassphraseEnabled": "Disabled" + } + }, + "Password": null, + "PasswordChangeRequired": false, + "PasswordExpiration": null, + "RoleId": "Administrator", + "SNMP": { + "AuthenticationKey": null, + "AuthenticationKeySet": true, + "AuthenticationProtocol": "HMAC_MD5", + "EncryptionKey": null, + "EncryptionKeySet": true, + "EncryptionProtocol": "CBC_DES" + }, + "StrictAccountTypes": false, + "UserName": "root" +}" +}</td> +<td>Details of the iDRAC user account that is created or modified.</td> +</tr> +</tbody> +</table> + +## Examples + +--- + +```yml +- name: Configure a new iDRAC user + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "192.1.2.1" + username: "username" + password: "password" + ca_path: "/path/to/ca_cert.pem" + state: present + user_name: user_name + user_password: user_password + privilege: Administrator + ipmi_lan_privilege: Administrator + ipmi_serial_privilege: Administrator + enable: true + sol_enable: true + protocol_enable: true + authentication_protocol: SHA + privacy_protocol: AES +``` + +```yml +- name: Modify username and password for the existing iDRAC user + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "192.1.2.1" + username: "username" + password: "password" + ca_path: "/path/to/ca_cert.pem" + state: present + user_name: user_name + new_user_name: new_user_name + user_password: user_password +``` + +```yml +-- name: Delete existing iDRAC user account + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "192.1.2.1" + username: "username" + password: "password" + ca_path: "/path/to/ca_cert.pem" + state: absent + user_name: user_name +``` +## Author Information + +--- + +Dell Technologies <br> +Kritika Bhateja (Kritika.Bhateja@Dell.com) 2024 diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/defaults/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/defaults/main.yml new file mode 100644 index 000000000..e73b71e4f --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/defaults/main.yml @@ -0,0 +1,6 @@ +--- +# defaults file for idrac_user +validate_certs: true +https_timeout: 30 +https_port: 443 +state: present diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/handlers/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/handlers/main.yml new file mode 100644 index 000000000..8ba5fa018 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for idrac_user diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/meta/argument_specs.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/meta/argument_specs.yml new file mode 100644 index 000000000..8075581bc --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/meta/argument_specs.yml @@ -0,0 +1,170 @@ +--- +argument_specs: + main: + version_added: "9.0.0" + short_description: Role to manage local users for iDRAC. + description: + - Role to manage manage local users for iDRACs + (iDRAC8 and iDRAC9 only) for Dell PowerEdge servers. + options: + hostname: + required: true + type: str + description: IPv4, IPv6 Address or hostname of the iDRAC. + username: + type: str + description: iDRAC username with 'Administrator' privilege. + 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 HTTPS socket level timeout in seconds. + type: int + default: 30 + state: + description: + - Select C(present) to create or modify a user account. + - Select C(absent) to remove a user account. + type: str + default: present + choices: + [ + "present", + "absent" + ] + user_name: + description: Provide username of the iDRAC user account that + is created, deleted, or modified. + type: str + required: true + user_password: + description: + - Password for the iDRAC user account that is created, + or modified. The password can be changed when the user + account is modified. + - To ensure security, the I(user_password) must be at least eight + characters long and must contain lowercase and upper-case + characters, numbers, and special characters. + type: str + new_user_name: + description: Provide the I(user_name) for the iDRAC user + account that is modified. + type: str + privilege: + description: + - Following are the role-based privileges. + - A user with C(Administrator) privilege can log in to iDRAC, + and then configure iDRAC, configure users, clear logs, control + and configure system, access virtual console, access virtual + media, test alerts, and execute debug commands. + - A user with C(Operator) privilege can log in to iDRAC, and then + configure iDRAC, control and configure system, access virtual + console, access virtual media, and execute debug commands. + - A user with C(ReadOnly) privilege can only log in to iDRAC. + - A user with C(None), no privileges assigned. + - Will be ignored, if I(custom_privilege) parameter is provided. + type: str + choices: + [ + "Administrator", + "ReadOnly", + "Operator", + "None" + ] + custom_privilege: + description: + - Provide the custom role-based authority privileges allowed + for the user . + - To create a custom privilege, add up the privilege decimal + values as defined below. + Login - 1 + Configure - 2 + Configure Users - 4 + Logs - 8 + System Control - 16 + Access Virtual Console - 32 + Access Virtual Media - 64 + System Operations - 128 + Debug - 256 + - The value has to be in the range 0-511. + type: int + ipmi_lan_privilege: + description: The Intelligent Platform Management + Interface LAN privilege level assigned to the user. + type: str + choices: + [ + "Administrator", + "Operator", + "User", + "No Access" + ] + ipmi_serial_privilege: + description: + - The Intelligent Platform Management Interface Serial Port + privilege level assigned to the user. + - This option is only applicable for rack and tower servers. + type: str + choices: + [ + "Administrator", + "Operator", + "User", + "No Access" + ] + enable: + description: Provide the option to enable or disable a user + from logging in to iDRAC. + type: bool + sol_enable: + description: Enables Serial Over Lan (SOL) for an iDRAC user. + type: bool + protocol_enable: + description: Enables SNMPv3 protocol for the iDRAC user. + type: bool + authentication_protocol: + description: + - This option allows to configure one of the following + authentication protocol types to authenticate the iDRAC user. + - Secure Hash Algorithm C(SHA). + - Message Digest 5 C(MD5). + - If C(None) is selected, then the authentication protocol + is not configured. + type: str + choices: + [ + "None", + "SHA", + "MD5" + ] + privacy_protocol: + description: + - This option allows to configure one of the following + privacy encryption protocols for the iDRAC user. + - Data Encryption Standard C(DES). + - Advanced Encryption Standard C(AES). + - If C(None) is selected, then the privacy protocol = + is not configured. + type: str + choices: + [ + "None", + "DES", + "AES" + ] diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/meta/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/meta/main.yml new file mode 100644 index 000000000..b2d809a64 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/meta/main.yml @@ -0,0 +1,21 @@ +--- +galaxy_info: + author: Kritika-Bhateja + description: This role helps to manage local users for iDRAC. + company: Dell Technologies + license: GPL-3.0-only + min_ansible_version: "2.15.8" + 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_user/molecule/TC-152120/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152120/converge.yml new file mode 100644 index 000000000..e2d712034 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152120/converge.yml @@ -0,0 +1,49 @@ +--- +- name: Validate creating a user with all parameters + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + tasks: + - name: Configure a new iDRAC user with all parameters except user_password + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + user_password: 'test1234' + privilege: Administrator + ipmi_lan_privilege: Administrator + ipmi_serial_privilege: Administrator + enable: true + sol_enable: true + protocol_enable: true + authentication_protocol: SHA + privacy_protocol: AES + tags: molecule-idempotence-notest + + - name: Asserting user creation in check mode + ansible.builtin.assert: + that: idrac_user_out.msg == "Changes found to commit!" + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Fetching user info in normal mode + ansible.builtin.include_tasks: + file: ../resources/idrac_user/get_user_info.yml + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user creation in normal mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == "Successfully created user account." + - "{{ (user_details.user_info | length) != 0 }}" + - user_details.user_info[0].UserName == idrac_user_account.UserName + - user_details.user_info[0].RoleId == "Administrator" + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152120/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152120/molecule.yml new file mode 100644 index 000000000..12be22020 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152120/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/idrac_user/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152146/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152146/converge.yml new file mode 100644 index 000000000..bff8a0d5b --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152146/converge.yml @@ -0,0 +1,46 @@ +--- +- name: Validate creating a user with minimum required parameters + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + idem_msg: "Requested changes are already present in the user slot." + tasks: + - name: Configure a new iDRAC user with all parameters except user_password + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + + - name: Asserting user creation in check mode + ansible.builtin.assert: + that: idrac_user_out.msg == "Changes found to commit!" + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Fetching user info in normal mode + ansible.builtin.include_tasks: + file: ../resources/idrac_user/get_user_info.yml + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user creation in normal mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == "Successfully created user account." + - "{{ (user_details.user_info | length) != 0 }}" + - user_details.user_info[0].UserName == idrac_user_account.UserName + - user_details.user_info[0].RoleId == "None" + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user creation in idempotency mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == idem_msg + when: not ansible_check_mode and not idrac_user_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152146/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152146/molecule.yml new file mode 100644 index 000000000..12be22020 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152146/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/idrac_user/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152147/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152147/converge.yml new file mode 100644 index 000000000..d96518aae --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152147/converge.yml @@ -0,0 +1,32 @@ +--- +- name: Verifying custom_previlege has precedence over previlege parameters + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + roles: + - role: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + user_password: '#testABCdef1234!' + privilege: Operator + custom_privilege: 1 + + tasks: + - name: Fetching user info in normal mode + ansible.builtin.include_tasks: + file: ../resources/idrac_user/get_user_info.yml + + - name: Asserting user creation in normal mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == "Successfully created user account." + - "{{ (user_details.user_info | length) != 0 }}" + - user_details.user_info[0].UserName == idrac_user_account.UserName + - user_details.user_info[0].RoleId == "ReadOnly" + - idrac_user_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152147/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152147/molecule.yml new file mode 100644 index 000000000..326227dee --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152147/molecule.yml @@ -0,0 +1,10 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/idrac_user/cleanup.yml +scenario: + test_sequence: + - cleanup + - converge + - destroy diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/converge.yml new file mode 100644 index 000000000..f5044b244 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/converge.yml @@ -0,0 +1,54 @@ +--- +- name: Validate modifying a user with all parameters + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + idem_msg: "Requested changes are already present in the user slot." + tasks: + - name: Modify iDRAC user with all parameters + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + privilege: Operator + ipmi_lan_privilege: User + ipmi_serial_privilege: User + enable: true + sol_enable: true + protocol_enable: true + authentication_protocol: SHA + privacy_protocol: AES + + - name: Asserting user creation in check mode + ansible.builtin.assert: + that: idrac_user_out.msg == "Changes found to commit!" + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Fetching user info in normal mode + ansible.builtin.include_tasks: + file: ../resources/idrac_user/get_user_info.yml + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user creation in normal mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == "Successfully updated user account." + - "{{ (user_details.user_info | length) != 0 }}" + - user_details.user_info[0].UserName == idrac_user_account.UserName + - user_details.user_info[0].RoleId == "Operator" + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user creation in Idempotency mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == idem_msg + when: not ansible_check_mode and not idrac_user_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/molecule.yml new file mode 100644 index 000000000..12be22020 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/idrac_user/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/prepare.yml new file mode 100644 index 000000000..29621fd56 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152148/prepare.yml @@ -0,0 +1,26 @@ +--- +- name: Prepare + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + tasks: + - name: Configure a new iDRAC user with all parameters + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + user_password: 'test1234' + privilege: ReadOnly + ipmi_lan_privilege: Operator + ipmi_serial_privilege: No Access + enable: true + sol_enable: true + protocol_enable: true + authentication_protocol: SHA + privacy_protocol: AES diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/converge.yml new file mode 100644 index 000000000..19ee7d60e --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/converge.yml @@ -0,0 +1,45 @@ +--- +- name: Validate creating a user with minimum required parameters with env + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + idem_msg: "Requested changes are already present in the user slot." + tasks: + - name: Modify iDRAC user with minimum requred parameters + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + custom_privilege: 511 + + - name: Asserting user creation in check mode + ansible.builtin.assert: + that: idrac_user_out.msg == "Changes found to commit!" + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Fetching user info in normal mode + ansible.builtin.include_tasks: + file: ../resources/idrac_user/get_user_info.yml + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user creation in normal mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == "Successfully updated user account." + - "{{ (user_details.user_info | length) != 0 }}" + - user_details.user_info[0].UserName == idrac_user_account.UserName + - user_details.user_info[0].RoleId == "Administrator" + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user creation in idempotency mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == idem_msg + when: not ansible_check_mode and not idrac_user_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/molecule.yml new file mode 100644 index 000000000..12be22020 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/idrac_user/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/prepare.yml new file mode 100644 index 000000000..11a785503 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152149/prepare.yml @@ -0,0 +1,19 @@ +--- +- name: Prepare + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + tasks: + - name: Configure a new iDRAC user with minimum required parameters + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + user_password: "#1234Abc" + custom_privilege: 0 diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/converge.yml new file mode 100644 index 000000000..672912bc3 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/converge.yml @@ -0,0 +1,51 @@ +--- +- name: Validate deleting a user + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + tasks: + - name: Delete iDRAC user + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: absent + user_name: "{{ idrac_user_name }}" + + - name: Asserting user deletion in check mode + ansible.builtin.assert: + that: idrac_user_out.msg == "Changes found to commit!" + when: ansible_check_mode + tags: molecule-idempotence-notest + + - name: Fetching user info in normal mode + ansible.builtin.include_tasks: + file: ../resources/idrac_user/get_user_info.yml + vars: + idrac_user_name: "{{ default(omit) }}" + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Extracting username + ansible.builtin.set_fact: + user_list: "{{ user_details.user_info | map(attribute='UserName') }}" + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user deletion in normal mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == "Successfully deleted user account." + - "{{ idrac_user_name not in user_list }}" + when: not ansible_check_mode and idrac_user_out.changed + tags: molecule-idempotence-notest + + - name: Asserting user deletion in idempotency mode + ansible.builtin.assert: + that: + - idrac_user_out.msg == "The user account is absent." + when: not ansible_check_mode and not idrac_user_out.changed diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/molecule.yml new file mode 100644 index 000000000..12be22020 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/molecule.yml @@ -0,0 +1,5 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/idrac_user/cleanup.yml diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/prepare.yml new file mode 100644 index 000000000..69b4ba6ab --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/TC-152150/prepare.yml @@ -0,0 +1,19 @@ +--- +- name: Prepare + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + tasks: + - name: Configure a new iDRAC user with minimum required parameters + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + user_password: "#1234Abc" + custom_privilege: 65 diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/default/converge.yml new file mode 100644 index 000000000..c0e0e96d2 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/default/converge.yml @@ -0,0 +1,163 @@ +--- +- name: TC-152151 - Validate all negative scenarios + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + max_user: 16 + tasks: + - name: Invalid hostname value + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "invalid" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for invalid hostname + ansible.builtin.assert: + that: > + idrac_user_out.msg == "<urlopen error [Errno -2] + Name or service not known>" + + - name: Invalid username value + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "invalid" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for invalid username + ansible.builtin.assert: + that: + - '"HTTP Error 401" in idrac_user_out.msg' + + - name: Invalid password value + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "invalid" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for invalid password + ansible.builtin.assert: + that: + - '"HTTP Error 401" in idrac_user_out.msg' + + - name: Invalid validate_certs value + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: invalid + state: present + user_name: "{{ idrac_user_name }}" + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for invalid validate_certs + ansible.builtin.assert: + that: + - '"not a valid boolean" in idrac_user_out.msg' + + - name: Invalid ca_path value + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + ca_path: invalid + state: present + user_name: "{{ idrac_user_name }}" + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for invalid ca_path + ansible.builtin.assert: + that: + - idrac_user_out.failed + + - name: Invalid username value + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "12345@Dell" + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for invalid username + ansible.builtin.assert: + that: + - '"HTTP Error 400" in idrac_user_out.msg' + + - name: Delete a idrac_user by giving invalid user_name + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: absent + user_name: "12345Dell" + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for deletion of a idrac_user by giving invalid user_name + ansible.builtin.assert: + that: + - idrac_user_out.msg == "The user account is absent." + + - name: Invalid value for "custom_priviledge" + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + user_name: "{{ idrac_user_name }}" + user_password: "#123Dell456!" + custom_privilege: -1 + ignore_errors: true + ignore_unreachable: true + register: idrac_user_fail_case + + - name: Asserting for invalid value for "custom_priviledge" + ansible.builtin.assert: + that: > + idrac_user_out.msg == "custom_privilege value should be from 0 to + 511." diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/default/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/default/molecule.yml new file mode 100644 index 000000000..326227dee --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/default/molecule.yml @@ -0,0 +1,10 @@ +--- +provisioner: + name: ansible + playbooks: + cleanup: ../resources/idrac_user/cleanup.yml +scenario: + test_sequence: + - cleanup + - converge + - destroy diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/resources/idrac_user/cleanup.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/resources/idrac_user/cleanup.yml new file mode 100644 index 000000000..6b1aea81f --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/resources/idrac_user/cleanup.yml @@ -0,0 +1,17 @@ +--- +- name: Cleanup + hosts: all + gather_facts: false + vars: + idrac_user_name: "moleculeTest" + tasks: + - name: Deleting iDRAC user + ansible.builtin.import_role: + name: idrac_user + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: absent + user_name: "{{ idrac_user_name }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/resources/idrac_user/get_user_info.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/resources/idrac_user/get_user_info.yml new file mode 100644 index 000000000..c8151b698 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/molecule/resources/idrac_user/get_user_info.yml @@ -0,0 +1,9 @@ +--- +- name: Fetching user info + dellemc.openmanage.idrac_user_info: + idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}" + idrac_user: "{{ lookup('env', 'IDRAC_USER') }}" + idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + username: "{{ idrac_user_name | default(omit) }}" + register: user_details diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/absent.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/absent.yml new file mode 100644 index 000000000..619d70281 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/absent.yml @@ -0,0 +1,14 @@ +--- +- name: Delete existing iDRAC user account + dellemc.openmanage.idrac_user: + idrac_ip: "{{ hostname }}" + idrac_user: "{{ username | default(omit) }}" + idrac_password: "{{ password | default(omit) }}" + idrac_port: "{{ https_port }}" + ca_path: "{{ ca_path | default(omit) }}" + validate_certs: "{{ validate_certs }}" + state: "{{ state }}" + user_name: "{{ user_name }}" + timeout: "{{ https_timeout }}" + register: idrac_user_out + delegate_to: "{{ idrac_user_delegate }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/get_user.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/get_user.yml new file mode 100644 index 000000000..669743cc2 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/get_user.yml @@ -0,0 +1,22 @@ +--- +- name: Set user_name based on new_user_name + ansible.builtin.set_fact: + idrac_user_present_name: "{{ new_user_name if new_user_name is defined else user_name }}" + +- name: Fetch user account details + dellemc.openmanage.idrac_user_info: + idrac_ip: "{{ hostname }}" + idrac_user: "{{ username | default(omit) }}" + idrac_password: "{{ password | default(omit) }}" + idrac_port: "{{ https_port }}" + ca_path: "{{ ca_path | default(omit) }}" + validate_certs: "{{ validate_certs }}" + username: "{{ idrac_user_present_name }}" + timeout: "{{ https_timeout }}" + register: idrac_user_account + delegate_to: "{{ idrac_user_delegate }}" + +- name: Extracting user account details + ansible.builtin.set_fact: + idrac_user_account: "{{ idrac_user_account.user_info[0] | + ansible.utils.remove_keys('Keys') }}" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/main.yml new file mode 100644 index 000000000..2ba2f734f --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/main.yml @@ -0,0 +1,10 @@ +--- +# tasks file for idrac_user + +- name: Create or modify user + ansible.builtin.include_tasks: present.yml + when: state == "present" + +- name: Delete user + ansible.builtin.include_tasks: absent.yml + when: state == "absent" diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/present.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/present.yml new file mode 100644 index 000000000..3997f441b --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/tasks/present.yml @@ -0,0 +1,29 @@ +--- +- name: Create or modify a iDRAC user + dellemc.openmanage.idrac_user: + idrac_ip: "{{ hostname }}" + idrac_user: "{{ username | default(omit) }}" + idrac_password: "{{ password | default(omit) }}" + idrac_port: "{{ https_port }}" + ca_path: "{{ ca_path | default(omit) }}" + validate_certs: "{{ validate_certs }}" + state: "{{ state }}" + user_name: "{{ user_name }}" + user_password: "{{ user_password | default(omit) }}" + new_user_name: "{{ new_user_name | default(omit) }}" + privilege: "{{ privilege | default(omit) }}" + custom_privilege: "{{ custom_privilege | default(omit) }}" + ipmi_lan_privilege: "{{ ipmi_lan_privilege | default(omit) }}" + ipmi_serial_privilege: "{{ ipmi_serial_privilege | default(omit) }}" + enable: "{{ enable | default(omit) }}" + sol_enable: "{{ sol_enable | default(omit) }}" + protocol_enable: "{{ protocol_enable | default(omit) }}" + authentication_protocol: "{{ authentication_protocol | default(omit) }}" + privacy_protocol: "{{ privacy_protocol | default(omit) }}" + timeout: "{{ https_timeout }}" + register: idrac_user_out + delegate_to: "{{ idrac_user_delegate }}" + +- name: Fetch user account information + ansible.builtin.include_tasks: get_user.yml + when: idrac_user_out.changed and not ansible_check_mode diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/tests/inventory b/ansible_collections/dellemc/openmanage/roles/idrac_user/tests/inventory new file mode 100644 index 000000000..878877b07 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/tests/test.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/tests/test.yml new file mode 100644 index 000000000..a3a34d106 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/tests/test.yml @@ -0,0 +1,6 @@ +--- +- name: Executing idrac user + hosts: localhost + remote_user: root + roles: + - idrac_user diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_user/vars/main.yml b/ansible_collections/dellemc/openmanage/roles/idrac_user/vars/main.yml new file mode 100644 index 000000000..86d2a24e3 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/idrac_user/vars/main.yml @@ -0,0 +1,12 @@ +--- +# vars file for idrac_user +idrac_user_delegate: + "{{ lookup('ansible.builtin.env', 'RUNON', default='localhost') }}" +idrac_user_uri_headers: + Accept: "application/json" + Content-Type: "application/json" +idrac_user_uri_body_format: "json" +idrac_user_uri_status_code: 200 +idrac_user_uri_return_content: true +idrac_user_force_basic_auth: true +idrac_user_uri_method: GET diff --git a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/__create_virtual_drive.yml b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/__create_virtual_drive.yml new file mode 100644 index 000000000..664d596e6 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/__create_virtual_drive.yml @@ -0,0 +1,29 @@ +--- +- name: Setting controller ID + ansible.builtin.set_fact: + redfish_storage_volume_controller_id: "{{ lookup('env', 'CONTROLLER_ID') }}" + +- name: Pre-req Create a volume. + ansible.builtin.import_role: + name: redfish_storage_volume + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + state: present + raid_type: "RAID0" + name: "VD" # noqa: var-naming[no-reserved] + controller_id: "{{ redfish_storage_volume_controller_id }}" + drives: "{{ lookup('env', 'PHYSICAL_DISK') }}" + job_wait: true + check_mode: false + +- name: Fetching Volume_id from iDRAC + ansible.builtin.include_tasks: ../__get_helper.yml + vars: + url: "Systems/System.Embedded.1/Storage/{{ redfish_storage_volume_controller_id }}/Volumes" + +- name: Extracting volume_id + ansible.builtin.set_fact: + redfish_storage_volume_id: "{{ (redfish_storage_volume_fetched_output.json.Members | last)['@odata.id'] | ansible.builtin.split('/') | last }}" diff --git a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/__job_track.yml b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/__job_track.yml new file mode 100644 index 000000000..4feafacaf --- /dev/null +++ b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/__job_track.yml @@ -0,0 +1,17 @@ +--- +- name: Track job + ansible.builtin.uri: + url: "https://{{ lookup('env', 'IDRAC_IP') }}/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs/{{ job_id }}" + user: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + method: GET + force_basic_auth: true + validate_certs: false + status_code: 200 + headers: 'Accept=application/json' + register: redfish_storage_volume_job_wait + until: redfish_storage_volume_job_wait.json.JobState == "Completed" or redfish_storage_volume_job_wait.json.JobState == "Failed" + failed_when: redfish_storage_volume_job_wait.json.JobState == "Failed" + retries: 20 + delay: 30 + check_mode: false diff --git a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml index 72b2e5977..221fe3bbd 100644 --- a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml @@ -8,7 +8,7 @@ ansible.builtin.import_role: name: redfish_storage_volume vars: - hostname: "{{ lookup('env', 'INVALID_IDRAC_IP') }}" + hostname: "192.168.1.1" username: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false @@ -23,6 +23,7 @@ job_wait: false ignore_errors: true register: redfish_storage_volume_result + ignore_unreachable: true - name: Asserting after performing operation. ansible.builtin.assert: @@ -35,7 +36,7 @@ vars: hostname: "{{ lookup('env', 'IDRAC_IP') }}" username: "{{ lookup('env', 'IDRAC_USER') }}" - password: "{{ lookup('env', 'INVALID_IDRAC_PASSWORD') }}" + password: "invalid_password" validate_certs: false state: present volume_type: "NonRedundant" @@ -78,6 +79,7 @@ ansible.builtin.assert: that: |- redfish_storage_volume_out.msg == "HTTP Error 400: Bad Request" + when: not ansible_check_mode - name: To check the behaviour of invalid certificate path. ansible.builtin.import_role: @@ -87,7 +89,7 @@ username: "{{ lookup('env', 'IDRAC_USER') }}" password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: true - ca_path: "{{ lookup('env', 'INVALID_CERT_PATH') }}" + ca_path: "/tmp/invalid_ca_path.pem" state: present volume_type: "SpannedStripesWithParity" name: "VD" # noqa: var-naming[no-reserved] @@ -99,6 +101,7 @@ job_wait: false ignore_errors: true register: redfish_storage_volume_result + ignore_unreachable: true - name: Asserting after performing operation for invalid certificate path. ansible.builtin.assert: @@ -127,6 +130,6 @@ - name: Asserting after performing operation for invalid volume type. ansible.builtin.assert: - that: |- + that: > redfish_storage_volume_out.msg == "value of volume_type must be one of: NonRedundant, Mirrored, StripedWithParity, SpannedMirrors, SpannedStripesWithParity, got: InvalidMirrored" diff --git a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/initialization/converge.yml b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/initialization/converge.yml index a76faebd4..4c0bdeba1 100644 --- a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/initialization/converge.yml +++ b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/initialization/converge.yml @@ -13,43 +13,65 @@ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" validate_certs: false command: initialize - volume_id: "{{ lookup('env', 'INVALID_VOLUME_ID') }}" + volume_id: "invalid_volume_id" initialize_type: "Fast" ignore_errors: true register: redfish_storage_volume_result - name: Asserting operation for initialization of type Fast. ansible.builtin.assert: - that: redfish_storage_volume_out.msg == "Specified Volume Id Disk.Virtual.0:RAID.Mezzanine.1C-1-test does not exist in the System." + that: redfish_storage_volume_out.msg == "Specified Volume Id invalid_volume_id does not exist in the System." - - name: To check the behaviour of Initialization type Fast. - ansible.builtin.import_role: - name: redfish_storage_volume - vars: - hostname: "{{ lookup('env', 'IDRAC_IP') }}" - username: "{{ lookup('env', 'IDRAC_USER') }}" - password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" - validate_certs: false - command: initialize - volume_id: "{{ lookup('env', 'VOLUME_ID') }}" - initialize_type: "Fast" + - name: Running for Initialization type scenarios + block: + - name: Pre-req Create a volume. + ansible.builtin.include_tasks: + file: ../__create_virtual_drive.yml - - name: Asserting operation for initialization type Fast. - ansible.builtin.assert: - that: redfish_storage_volume_out.msg == "Successfully submitted initialize volume task." + - name: To check the behaviour of Initialization type Fast. + ansible.builtin.import_role: + name: redfish_storage_volume + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + command: initialize + volume_id: "{{ redfish_storage_volume_id }}" + initialize_type: "Fast" + job_wait: false - - name: To check the behaviour of Initialization type Slow. - ansible.builtin.import_role: - name: redfish_storage_volume - vars: - hostname: "{{ lookup('env', 'IDRAC_IP') }}" - username: "{{ lookup('env', 'IDRAC_USER') }}" - password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" - validate_certs: false - command: initialize - volume_id: "{{ lookup('env', 'VOLUME_ID') }}" - initialize_type: "Slow" + - name: Asserting operation for initialization type Fast. + ansible.builtin.assert: + that: redfish_storage_volume_out.msg == "Successfully submitted initialize volume task." - - name: Asserting operation for initialization type Slow. - ansible.builtin.assert: - that: redfish_storage_volume_out.msg == "Successfully submitted initialize volume task." + - name: Track the initialization job + ansible.builtin.include_tasks: + file: ../__job_track.yml + vars: + job_id: "{{ redfish_storage_volume_out.job_status.Id }}" + + - name: To check the behaviour of Initialization type Slow. + ansible.builtin.import_role: + name: redfish_storage_volume + vars: + hostname: "{{ lookup('env', 'IDRAC_IP') }}" + username: "{{ lookup('env', 'IDRAC_USER') }}" + password: "{{ lookup('env', 'IDRAC_PASSWORD') }}" + validate_certs: false + command: initialize + volume_id: "{{ redfish_storage_volume_id }}" + initialize_type: "Slow" + job_wait: true + + - name: Asserting operation for initialization type Slow. + ansible.builtin.assert: + that: redfish_storage_volume_out.msg == "The job is successfully completed." + + always: + - name: Deleting VD + ansible.builtin.include_tasks: + file: ../__delete_virtual_drive.yml + when: + - not ansible_check_mode + - redfish_storage_volume_id is defined |