diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:03:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:03:42 +0000 |
commit | 66cec45960ce1d9c794e9399de15c138acb18aed (patch) | |
tree | 59cd19d69e9d56b7989b080da7c20ef1a3fe2a5a /ansible_collections/dellemc/openmanage/playbooks/redfish | |
parent | Initial commit. (diff) | |
download | ansible-upstream.tar.xz ansible-upstream.zip |
Adding upstream version 7.3.0+dfsg.upstream/7.3.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/dellemc/openmanage/playbooks/redfish')
10 files changed, 730 insertions, 0 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 new file mode 100644 index 00000000..15fa188d --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware.yml @@ -0,0 +1,32 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + image_uri: "/home/firmware_repo/component.exe" + + tags: + - local-update + + - name: "Update the firmware from a single executable file available in a HTTP protocol" + 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 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 new file mode 100644 index 00000000..105f4189 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_http_jobtracking.yml @@ -0,0 +1,92 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + 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 + + - name: "Update the firmware from a single executable with job tracking till completion" + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: job_result + until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + + - name: "Update the firmware from a single executable reboot." + uri: + url: "https://{{ baseuri }}{{ reboot_uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "POST" + body_format: raw + body: '{"ResetType": "ForceRestart"}' + use_proxy: yes + status_code: 204 + return_content: no + validate_certs: no + force_basic_auth: yes + 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.' + + - name: "Update the firmware from a single executable Waits for 4 minutes." + wait_for: + timeout: 240 + when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + + - name: "Update the firmware from a single executable with job tracking till completion." + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: final_result + until: final_result.json.TaskState == 'Completed' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + + - name: "Update the firmware from a single executable fact." + 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 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 new file mode 100644 index 00000000..8ea91cc3 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_local_jobtracking.yml @@ -0,0 +1,92 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + image_uri: "/home/firmware_repo/component.exe" + register: result + + - name: "Update the firmware from a single executable with job tracking till completion." + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: job_result + until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + + - name: "Update the firmware from a single executable reboot." + uri: + url: "https://{{ baseuri }}{{ reboot_uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "POST" + body_format: raw + body: '{"ResetType": "ForceRestart"}' + use_proxy: yes + status_code: 204 + return_content: no + validate_certs: no + force_basic_auth: yes + 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.' + + - name: "Update the firmware from a single executable Waits for 4 minutes." + wait_for: + timeout: 240 + when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.' + + - name: "Update the firmware from a single executable with job tracking till completion." + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: final_result + until: final_result.json.TaskState == 'Completed' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + + - name: "Update the firmware from a single executable fact." + 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 diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_event_subscription.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_event_subscription.yml new file mode 100644 index 00000000..7fa5e40c --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_event_subscription.yml @@ -0,0 +1,46 @@ +--- +- hosts: redfish + connection: local + name: Configure Redfish subscriptions + gather_facts: False + + collections: + - dellemc.openmanage + + tasks: + - name: Add Redfish metric subscription + redfish_event_subscription: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + 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 + + - name: Add Redfish alert subscription + redfish_event_subscription: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + 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 + + - name: Delete Redfish subscription with a specified destination + redfish_event_subscription: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + 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 diff --git a/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_powerstate.yml b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_powerstate.yml new file mode 100644 index 00000000..bacce0cc --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/redfish_powerstate.yml @@ -0,0 +1,26 @@ +--- +- hosts: redfish + connection: local + name: Configure Server Power Setting + gather_facts: False + + collections: + - dellemc.openmanage + + 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 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" 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 new file mode 100644 index 00000000..0c1380a0 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume.yml @@ -0,0 +1,85 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "present" + volume_type: "Mirrored" + name: "VD0" + controller_id: "RAID.Slot.1-1" + drives: + - Disk.Bay.5:Enclosure.Internal.0-1:RAID.Slot.1-1 + - Disk.Bay.6:Enclosure.Internal.0-1:RAID.Slot.1-1 + block_size_bytes: 512 + capacity_bytes: 299439751168 + optimum_io_size_bytes: 65536 + encryption_types: NativeDriveEncryption + encrypted: true + register: result + tags: + - create_volume1 + + - name: Create a volume with minimum options. + redfish_storage_volume: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "present" + controller_id: "RAID.Slot.1-1" + volume_type: "NonRedundant" + drives: + - Disk.Bay.1:Enclosure.Internal.0-1:RAID.Slot.1-1 + tags: + - create_volume2 + + - name: Modify a volume's encryption type settings. + redfish_storage_volume: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "present" + volume_id: "Disk.Virtual.5:RAID.Slot.1-1" + encryption_types: "ControllerAssisted" + encrypted: true + tags: + - modify_volume + + - name: Initialize an existing volume. + redfish_storage_volume: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + command: "initialize" + volume_id: "Disk.Virtual.5:RAID.Slot.1-1" + initialize_type: "Slow" + tags: + - initialize_volume + + - name: Delete an existing volume. + redfish_storage_volume: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "absent" + volume_id: "Disk.Virtual.5:RAID.Slot.1-1" + tags: + - delete_volume 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 new file mode 100644 index 00000000..fcf596cd --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_create_job_tracking.yml @@ -0,0 +1,93 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "present" + name: "VD_BOSS" + controller_id: "AHCI.Slot.6-1" + drives: + - Disk.Direct.1-1:AHCI.Slot.6-1 + - Disk.Direct.0-0:AHCI.Slot.6-1 + optimum_io_size_bytes: 65536 + volume_type: Mirrored + register: result + tags: + - create_volume + + - name: "View the job details to track the status of the create storage volume task" + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: job_result + failed_when: "'json' not in job_result" + until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + tags: + - job-tracking + + - name: "Reboot the system if the job status is pending." + uri: + url: "https://{{ baseuri }}{{ reboot_uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "POST" + body_format: raw + body: '{"ResetType": "ForceRestart"}' + use_proxy: yes + status_code: 204 + return_content: no + validate_certs: no + force_basic_auth: yes + 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.' + + - name: "View the job details to verify if the task status is completed." + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: final_result + failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK" + until: final_result.json.TaskState == 'Completed' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" 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 new file mode 100644 index 00000000..34a821d7 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_delete_job_tracking.yml @@ -0,0 +1,87 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "absent" + volume_id: "Disk.Virtual.1:RAID.Slot.1-1" + register: result + tags: + - delete_volume + + - name: "View the job details to track the status of the delete storage volume task" + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: job_result + failed_when: "'json' not in job_result" + until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + tags: + - job-tracking + + - name: "Reboot the system if the job status is pending." + uri: + url: "https://{{ baseuri }}{{ reboot_uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "POST" + body_format: raw + body: '{"ResetType": "ForceRestart"}' + use_proxy: yes + status_code: 204 + return_content: no + validate_certs: no + force_basic_auth: yes + 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.' + + - name: "View the job details to verify if the task status is completed." + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: final_result + failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK" + until: final_result.json.TaskState == 'Completed' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" 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 new file mode 100644 index 00000000..fb79a288 --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_initialize_job_tracking.yml @@ -0,0 +1,88 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + command: "initialize" + volume_id: "Disk.Virtual.1:RAID.Slot.1-1" + initialize_type: "Slow" + register: result + tags: + - initialize_volume + + - name: "View the job details to track the status of the initialization task" + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: job_result + failed_when: "'json' not in job_result" + until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + tags: + - job-tracking + + - name: "Reboot the system if the job status is pending." + uri: + url: "https://{{ baseuri }}{{ reboot_uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "POST" + body_format: raw + body: '{"ResetType": "ForceRestart"}' + use_proxy: yes + status_code: 204 + return_content: no + validate_certs: no + force_basic_auth: yes + 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.' + + - name: "View the job details to verify if the task status is completed." + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: final_result + failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK" + until: final_result.json.TaskState == 'Completed' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" 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 new file mode 100644 index 00000000..02bbc19d --- /dev/null +++ b/ansible_collections/dellemc/openmanage/playbooks/redfish/storage/redfish_storage_volume_modify_job_tracking.yml @@ -0,0 +1,89 @@ +--- +- hosts: redfish_hosts + connection: local + 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: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + ca_path: "/path/to/ca_cert.pem" + state: "present" + volume_id: "Disk.Virtual.1:RAID.Slot.1-1" + encryption_types: "ControllerAssisted" + encrypted: true + register: result + tags: + - modify_volume + + - name: "View the job details to track the status of the modify storage volume encryption task" + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: job_result + failed_when: "'json' not in job_result" + until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" + tags: + - job-tracking + + - name: "Reboot the system if the job status is pending." + uri: + url: "https://{{ baseuri }}{{ reboot_uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "POST" + body_format: raw + body: '{"ResetType": "ForceRestart"}' + use_proxy: yes + status_code: 204 + return_content: no + validate_certs: no + force_basic_auth: yes + 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.' + + - name: "View the job details to verify if the task status is completed." + uri: + url: "https://{{ baseuri }}{{ result.task.uri }}" + user: "{{ username }}" + password: "{{ password }}" + method: "GET" + use_proxy: yes + status_code: 200, 202 + return_content: yes + validate_certs: no + force_basic_auth: yes + headers: + Content-Type: "application/json" + Accept: "application/json" + register: final_result + failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK" + until: final_result.json.TaskState == 'Completed' + retries: "{{ retries_count }}" + delay: "{{ polling_interval }}" |