diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:35 +0000 |
commit | 7fec0b69a082aaeec72fee0612766aa42f6b1b4d (patch) | |
tree | efb569b86ca4da888717f5433e757145fa322e08 /ansible_collections/dellemc/openmanage/playbooks/redfish | |
parent | Releasing progress-linux version 7.7.0+dfsg-3~progress7.99u1. (diff) | |
download | ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.tar.xz ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.zip |
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/dellemc/openmanage/playbooks/redfish')
11 files changed, 378 insertions, 254 deletions
diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware.yml index 15fa188dd..b4313efcc 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware.yml @@ -1,32 +1,27 @@ --- -- hosts: redfish_hosts - connection: local +- name: "Ansible Module for Simple Firmware Update" + hosts: redfish_hosts gather_facts: false - name: "Ansible Module for Simple Firmware Update" - - collections: - - dellemc.openmanage tasks: - - - name: "Update the firmware from a single executable file available in a local path" - redfish_firmware: + - name: Update the firmware from a single executable file available in a local path + dellemc.openmanage.redfish_firmware: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" image_uri: "/home/firmware_repo/component.exe" - tags: - local-update + delegate_to: localhost - - name: "Update the firmware from a single executable file available in a HTTP protocol" - redfish_firmware: + - name: Update the firmware from a single executable file available in a HTTP protocol + dellemc.openmanage.redfish_firmware: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" image_uri: "http://192.168.0.1/firmware_repo/component.exe" - tags: - http-update + delegate_to: localhost diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_http_jobtracking.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_http_jobtracking.yml index 105f4189a..eb779e2a1 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_http_jobtracking.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_http_jobtracking.yml @@ -1,38 +1,34 @@ --- -- hosts: redfish_hosts - connection: local +- name: Ansible Module for Simple Firmware Update + hosts: redfish_hosts gather_facts: false - name: "Ansible Module for Simple Firmware Update" vars: retries_count: 100 polling_interval: 5 reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset" - collections: - - dellemc.openmanage - tasks: - - - name: "Update the firmware from a single executable file available in a HTTP protocol" - redfish_firmware: + - name: Update the firmware from a single executable file available in a HTTP protocol + dellemc.openmanage.redfish_firmware: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" image_uri: "http://192.168.0.1/firmware_repo/component.exe" register: result + delegate_to: localhost - - name: "Update the firmware from a single executable with job tracking till completion" - uri: + - name: Update the firmware from a single executable with job tracking till completion + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -40,43 +36,46 @@ until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost - - name: "Update the firmware from a single executable reboot." - uri: + - name: Update the firmware from a single executable reboot. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ reboot_uri }}" user: "{{ username }}" password: "{{ password }}" method: "POST" body_format: raw body: '{"ResetType": "ForceRestart"}' - use_proxy: yes + use_proxy: true status_code: 204 - return_content: no - validate_certs: no - force_basic_auth: yes + return_content: false + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" register: reboot_result changed_when: reboot_result.status == 204 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "Update the firmware from a single executable Waits for 4 minutes." - wait_for: + - name: Update the firmware from a single executable Waits for 4 minutes. + ansible.builtin.wait_for: timeout: 240 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "Update the firmware from a single executable with job tracking till completion." - uri: + - name: Update the firmware from a single executable with job tracking till completion. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -84,9 +83,10 @@ until: final_result.json.TaskState == 'Completed' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost - - name: "Update the firmware from a single executable fact." - set_fact: + - name: Update the firmware from a single executable fact. + ansible.builtin.set_fact: job_details: "{{ final_result.json }}" failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK" - changed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus == "OK"
\ No newline at end of file + changed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus == "OK" diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_local_jobtracking.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_local_jobtracking.yml index 8ea91cc3a..e62d5c81f 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_local_jobtracking.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_local_jobtracking.yml @@ -1,38 +1,34 @@ --- -- hosts: redfish_hosts - connection: local +- name: "Ansible Module for Simple Firmware Update" + hosts: redfish_hosts gather_facts: false - name: "Ansible Module for Simple Firmware Update" vars: retries_count: 100 polling_interval: 5 reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset" - collections: - - dellemc.openmanage - tasks: - - - name: "Update the firmware from a single executable file available in a local path" - redfish_firmware: + - name: Update the firmware from a single executable file available in a local path + dellemc.openmanage.redfish_firmware: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" image_uri: "/home/firmware_repo/component.exe" register: result + delegate_to: localhost - - name: "Update the firmware from a single executable with job tracking till completion." - uri: + - name: Update the firmware from a single executable with job tracking till completion. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -40,43 +36,46 @@ until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost - - name: "Update the firmware from a single executable reboot." - uri: + - name: Update the firmware from a single executable reboot. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ reboot_uri }}" user: "{{ username }}" password: "{{ password }}" method: "POST" body_format: raw body: '{"ResetType": "ForceRestart"}' - use_proxy: yes + use_proxy: true status_code: 204 - return_content: no - validate_certs: no - force_basic_auth: yes + return_content: false + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" register: reboot_result changed_when: reboot_result.status == 204 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "Update the firmware from a single executable Waits for 4 minutes." - wait_for: + - name: Update the firmware from a single executable Waits for 4 minutes. + ansible.builtin.wait_for: timeout: 240 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "Update the firmware from a single executable with job tracking till completion." - uri: + - name: Update the firmware from a single executable with job tracking till completion. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -84,9 +83,10 @@ until: final_result.json.TaskState == 'Completed' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost - - name: "Update the firmware from a single executable fact." - set_fact: + - name: Update the firmware from a single executable fact. + ansible.builtin.set_fact: job_details: "{{ final_result.json }}" failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK" - changed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus == "OK"
\ No newline at end of file + changed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus == "OK" diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_rollback.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_rollback.yml new file mode 100644 index 000000000..520288419 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_rollback.yml @@ -0,0 +1,45 @@ +--- +- name: "Ansible Module for Simple Firmware Rollback" + hosts: redfish_hosts + gather_facts: false + tasks: + + - name: Rollback a BIOS component firmware + dellemc.openmanage.redfish_firmware_rollback: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + name: "BIOS" + delegate_to: localhost + tags: rollback-bios + + - name: Rollback all NIC cards with a name starting from 'Broadcom Gigabit'. + dellemc.openmanage.redfish_firmware_rollback: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + name: "Broadcom Gigabit Ethernet.*" + delegate_to: localhost + tags: rollback-match + + - name: Rollback all the component firmware except BIOS component. + dellemc.openmanage.redfish_firmware_rollback: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + name: "(?!BIOS).*" + delegate_to: localhost + tags: rollback-except + + - name: Rollback all the available firmware component. + dellemc.openmanage.redfish_firmware_rollback: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + name: ".*" + delegate_to: localhost + tags: rollback-all diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_event_subscription.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_event_subscription.yml index 7fa5e40cc..0c7a7b755 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_event_subscription.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_event_subscription.yml @@ -1,46 +1,42 @@ --- -- hosts: redfish - connection: local - name: Configure Redfish subscriptions - gather_facts: False - - collections: - - dellemc.openmanage +- name: Configure Redfish subscriptions + hosts: redfish + gather_facts: false tasks: - name: Add Redfish metric subscription - redfish_event_subscription: - baseuri: "{{ baseuri }}" + dellemc.openmanage.redfish_event_subscription: + baseuri: "{{ baseuri }}" username: "{{ username }}" - password: "{{ password }}" + password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" destination: "https://192.168.1.100:8188" event_type: MetricReport event_format_type: MetricReport state: present - tags: add_metric_subscription + delegate_to: localhost - name: Add Redfish alert subscription - redfish_event_subscription: - baseuri: "{{ baseuri }}" + dellemc.openmanage.redfish_event_subscription: + baseuri: "{{ baseuri }}" username: "{{ username }}" - password: "{{ password }}" + password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" destination: "https://server01.example.com:8188" event_type: Alert event_format_type: Event state: present - tags: add_alert_subscription - + delegate_to: localhost + - name: Delete Redfish subscription with a specified destination - redfish_event_subscription: - baseuri: "{{ baseuri }}" + dellemc.openmanage.redfish_event_subscription: + baseuri: "{{ baseuri }}" username: "{{ username }}" - password: "{{ password }}" + password: "{{ password }}" ca_path: "/path/to/ca_cert.pem" destination: "https://server01.example.com:8188" state: absent - - tags: delete_subscription
\ No newline at end of file + tags: delete_subscription + delegate_to: localhost diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_powerstate.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_powerstate.yml index bacce0ccb..e2b15b085 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_powerstate.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_powerstate.yml @@ -1,26 +1,24 @@ --- -- hosts: redfish - connection: local - name: Configure Server Power Setting - gather_facts: False - - collections: - - dellemc.openmanage +- name: Configure Server Power Setting + hosts: redfish + gather_facts: false tasks: - - name: Manage power state of the first device. - redfish_powerstate: - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - ca_path: "/path/to/ca_cert.pem" - reset_type: "On" + - name: Manage power state of the first device. + dellemc.openmanage.redfish_powerstate: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + reset_type: "On" + delegate_to: localhost - - name: Manage power state of a specified device. - redfish_powerstate: - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - ca_path: "/path/to/ca_cert.pem" - reset_type: "ForceOff" - resource_id: "System.Embedded.1" + - name: Manage power state of a specified device. + dellemc.openmanage.redfish_powerstate: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + reset_type: "ForceOff" + resource_id: "System.Embedded.1" + delegate_to: localhost diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume.yml index 0c1380a05..def3dc33e 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume.yml @@ -1,19 +1,14 @@ --- -- hosts: redfish_hosts - connection: local +- name: "Redfish Storage Volume - Ansible Module" + hosts: redfish_hosts gather_facts: false - name: "Redfish Storage Volume - Ansible Module" vars: retries_count: 15 polling_interval: 5 - collections: - - dellemc.openmanage - tasks: - - name: Create a volume with supported options. - redfish_storage_volume: + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -33,9 +28,10 @@ register: result tags: - create_volume1 - + delegate_to: localhost + - name: Create a volume with minimum options. - redfish_storage_volume: + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -44,12 +40,103 @@ controller_id: "RAID.Slot.1-1" volume_type: "NonRedundant" drives: - - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 - tags: - - create_volume2 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 + tags: + - create_volume2 + delegate_to: localhost + + - name: Create a RAID6 volume. + dellemc.openmanage.redfish_storage_volume: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "present" + controller_id: "RAID.Slot.1-1" + raid_type: "RAID6" + drives: + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-2 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-3 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-4 + tags: + - create_raid6 + delegate_to: localhost + + - name: Create a RAID60 volume. + dellemc.openmanage.redfish_storage_volume: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "present" + controller_id: "RAID.Slot.1-1" + raid_type: "RAID60" + drives: + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-2 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-3 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-4 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-5 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-6 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-7 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-8 + tags: + - create_raid60 + delegate_to: localhost + + - name: Create a RAID0 on PERC controller on reset + dellemc.openmanage.redfish_storage_volume: + baseuri: "192.168.0.1" + username: "username" + password: "password" + state: "present" + controller_id: "RAID.Slot.1-1" + raid_type: "RAID0" + drives: + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-2 + apply_time: OnReset + tags: + - create_raid0_with_onreset + delegate_to: localhost + + - name: Create a RAID0 on BOSS controller with restart + dellemc.openmanage.redfish_storage_volume: + baseuri: "192.168.0.1" + username: "username" + password: "password" + state: "present" + controller_id: "RAID.Slot.1-1" + raid_type: "RAID0" + drives: + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-2 + apply_time: OnReset + reboot_server: true + tags: + - create_raid0_boss_with_onreset + delegate_to: localhost + + - name: Create a RAID0 on BOSS controller with force restart + dellemc.openmanage.redfish_storage_volume: + baseuri: "192.168.0.1" + username: "username" + password: "password" + state: "present" + controller_id: "RAID.Slot.1-1" + raid_type: "RAID0" + drives: + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-2 + reboot_server: true + force_reboot: true + tags: + - create_raid0_boss_with_onreset_force + delegate_to: localhost - name: Modify a volume's encryption type settings. - redfish_storage_volume: + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -60,9 +147,10 @@ encrypted: true tags: - modify_volume - + delegate_to: localhost + - name: Initialize an existing volume. - redfish_storage_volume: + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -72,9 +160,10 @@ initialize_type: "Slow" tags: - initialize_volume - + delegate_to: localhost + - name: Delete an existing volume. - redfish_storage_volume: + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -83,3 +172,4 @@ volume_id: "Disk.Virtual.5:RAID.Slot.1-1" tags: - delete_volume + delegate_to: localhost diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_create_job_tracking.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_create_job_tracking.yml index fcf596cd0..def58f5f6 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_create_job_tracking.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_create_job_tracking.yml @@ -1,19 +1,15 @@ --- -- hosts: redfish_hosts - connection: local +- name: "Redfish Storage Volume - Ansible Module" + hosts: redfish_hosts gather_facts: false - name: "Redfish Storage Volume - Ansible Module" vars: retries_count: 100 polling_interval: 10 reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset" - collections: - - dellemc.openmanage - tasks: - - name: "Create a storage volume" - redfish_storage_volume: + - name: Create a storage volume" + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -29,18 +25,19 @@ register: result tags: - create_volume + delegate_to: localhost - - name: "View the job details to track the status of the create storage volume task" - uri: + - name: View the job details to track the status of the create storage volume task" + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -51,38 +48,40 @@ delay: "{{ polling_interval }}" tags: - job-tracking - - - name: "Reboot the system if the job status is pending." - uri: + delegate_to: localhost + + - name: Reboot the system if the job status is pending." + ansible.builtin.uri: url: "https://{{ baseuri }}{{ reboot_uri }}" user: "{{ username }}" password: "{{ password }}" method: "POST" body_format: raw body: '{"ResetType": "ForceRestart"}' - use_proxy: yes + use_proxy: true status_code: 204 - return_content: no - validate_certs: no - force_basic_auth: yes + return_content: false + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" - register: reboot_result - changed_when: reboot_result.status == 204 + register: reboot_result + changed_when: reboot_result.status == 204 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "View the job details to verify if the task status is completed." - uri: + - name: View the job details to verify if the task status is completed." + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -91,3 +90,4 @@ until: final_result.json.TaskState == 'Completed' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_delete_job_tracking.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_delete_job_tracking.yml index 34a821d75..5c2858396 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_delete_job_tracking.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_delete_job_tracking.yml @@ -1,19 +1,15 @@ --- -- hosts: redfish_hosts - connection: local +- name: "Redfish Storage Volume - Ansible Module" + hosts: redfish_hosts gather_facts: false - name: "Redfish Storage Volume - Ansible Module" vars: retries_count: 100 polling_interval: 10 reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset" - collections: - - dellemc.openmanage - tasks: - - name: "Delete an existing volume." - redfish_storage_volume: + - name: Delete an existing volume. + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -23,18 +19,19 @@ register: result tags: - delete_volume + delegate_to: localhost - - name: "View the job details to track the status of the delete storage volume task" - uri: + - name: View the job details to track the status of the delete storage volume task + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -45,38 +42,40 @@ delay: "{{ polling_interval }}" tags: - job-tracking - - - name: "Reboot the system if the job status is pending." - uri: + delegate_to: localhost + + - name: Reboot the system if the job status is pending. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ reboot_uri }}" user: "{{ username }}" password: "{{ password }}" method: "POST" body_format: raw body: '{"ResetType": "ForceRestart"}' - use_proxy: yes + use_proxy: true status_code: 204 - return_content: no - validate_certs: no - force_basic_auth: yes + return_content: false + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" - register: reboot_result - changed_when: reboot_result.status == 204 + register: reboot_result + changed_when: reboot_result.status == 204 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "View the job details to verify if the task status is completed." - uri: + - name: View the job details to verify if the task status is completed. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -85,3 +84,4 @@ until: final_result.json.TaskState == 'Completed' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_initialize_job_tracking.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_initialize_job_tracking.yml index fb79a2885..4609977b5 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_initialize_job_tracking.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_initialize_job_tracking.yml @@ -1,19 +1,15 @@ --- -- hosts: redfish_hosts - connection: local +- name: "Redfish Storage Volume - Ansible Module" + hosts: redfish_hosts gather_facts: false - name: "Redfish Storage Volume - Ansible Module" vars: retries_count: 100 polling_interval: 10 reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset" - collections: - - dellemc.openmanage - tasks: - - name: "Initialize an existing volume." - redfish_storage_volume: + - name: Initialize an existing volume. + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -24,18 +20,19 @@ register: result tags: - initialize_volume + delegate_to: localhost - - name: "View the job details to track the status of the initialization task" - uri: + - name: View the job details to track the status of the initialization task + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -46,38 +43,40 @@ delay: "{{ polling_interval }}" tags: - job-tracking - - - name: "Reboot the system if the job status is pending." - uri: + delegate_to: localhost + + - name: Reboot the system if the job status is pending. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ reboot_uri }}" user: "{{ username }}" password: "{{ password }}" method: "POST" body_format: raw body: '{"ResetType": "ForceRestart"}' - use_proxy: yes + use_proxy: true status_code: 204 - return_content: no - validate_certs: no - force_basic_auth: yes + return_content: false + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" - register: reboot_result - changed_when: reboot_result.status == 204 + register: reboot_result + changed_when: reboot_result.status == 204 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "View the job details to verify if the task status is completed." - uri: + - name: View the job details to verify if the task status is completed. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -86,3 +85,4 @@ until: final_result.json.TaskState == 'Completed' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_modify_job_tracking.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_modify_job_tracking.yml index 02bbc19d1..5a9d088ce 100644 --- a/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_modify_job_tracking.yml +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_modify_job_tracking.yml @@ -1,19 +1,15 @@ --- -- hosts: redfish_hosts - connection: local +- name: "Redfish Storage Volume - Ansible Module" + hosts: redfish_hosts gather_facts: false - name: "Redfish Storage Volume - Ansible Module" vars: retries_count: 100 polling_interval: 10 reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset" - collections: - - dellemc.openmanage - tasks: - - name: "Modify storage volume encryption settings." - redfish_storage_volume: + - name: Modify storage volume encryption settings. + dellemc.openmanage.redfish_storage_volume: baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" @@ -25,18 +21,19 @@ register: result tags: - modify_volume + delegate_to: localhost - - name: "View the job details to track the status of the modify storage volume encryption task" - uri: + - name: View the job details to track the status of the modify storage volume encryption task + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -47,38 +44,40 @@ delay: "{{ polling_interval }}" tags: - job-tracking - - - name: "Reboot the system if the job status is pending." - uri: + delegate_to: localhost + + - name: Reboot the system if the job status is pending. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ reboot_uri }}" user: "{{ username }}" password: "{{ password }}" method: "POST" body_format: raw body: '{"ResetType": "ForceRestart"}' - use_proxy: yes + use_proxy: true status_code: 204 - return_content: no - validate_certs: no - force_basic_auth: yes + return_content: false + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" - register: reboot_result - changed_when: reboot_result.status == 204 + register: reboot_result + changed_when: reboot_result.status == 204 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + delegate_to: localhost - - name: "View the job details to verify if the task status is completed." - uri: + - name: View the job details to verify if the task status is completed. + ansible.builtin.uri: url: "https://{{ baseuri }}{{ result.task.uri }}" user: "{{ username }}" password: "{{ password }}" method: "GET" - use_proxy: yes + use_proxy: true status_code: 200, 202 - return_content: yes - validate_certs: no - force_basic_auth: yes + return_content: true + validate_certs: false + force_basic_auth: true headers: Content-Type: "application/json" Accept: "application/json" @@ -87,3 +86,4 @@ until: final_result.json.TaskState == 'Completed' retries: "{{ retries_count }}" delay: "{{ polling_interval }}" + delegate_to: localhost |