Debian Codegraph @

ansible_collections/dellemc/openmanage/playbooks/redfish/firmware/redfish_firmware_from_local_jobtracking.yml

raw symbols SCIP
1 ---
2 - name: "Ansible Module for Simple Firmware Update"
3 hosts: redfish_hosts
4 gather_facts: false
5 vars:
6 retries_count: 100
7 polling_interval: 5
8 reboot_uri: "/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"
9
10 tasks:
11 - name: Update the firmware from a single executable file available in a local path
12 dellemc.openmanage.redfish_firmware:
13 baseuri: "{{ baseuri }}"
14 username: "{{ username }}"
15 password: "{{ password }}"
16 ca_path: "/path/to/ca_cert.pem"
17 image_uri: "/home/firmware_repo/component.exe"
18 register: result
19 delegate_to: localhost
20
21 - name: Update the firmware from a single executable with job tracking
22 till completion
23 ansible.builtin.uri:
24 url: "https://{{ baseuri }}{{ result.task.uri }}"
25 user: "{{ username }}"
26 password: "{{ password }}"
27 method: "GET"
28 use_proxy: true
29 status_code: 200, 202
30 return_content: true
31 validate_certs: false
32 force_basic_auth: true
33 headers:
34 Content-Type: "application/json"
35 Accept: "application/json"
36 register: job_result
37 until: job_result.json.TaskState == 'Completed' or job_result.json.TaskState == 'Pending'
38 retries: "{{ retries_count }}"
39 delay: "{{ polling_interval }}"
40 delegate_to: localhost
41
42 - name: Update the firmware from a single executable reboot.
43 ansible.builtin.uri:
44 url: "https://{{ baseuri }}{{ reboot_uri }}"
45 user: "{{ username }}"
46 password: "{{ password }}"
47 method: "POST"
48 body_format: raw
49 body: '{"ResetType": "ForceRestart"}'
50 use_proxy: true
51 status_code: 204
52 return_content: false
53 validate_certs: false
54 force_basic_auth: true
55 headers:
56 Content-Type: "application/json"
57 Accept: "application/json"
58 register: reboot_result
59 changed_when: reboot_result.status == 204
60 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
61 delegate_to: localhost
62
63 - name: Update the firmware from a single executable Waits for 4 minutes.
64 ansible.builtin.wait_for:
65 timeout: 240
66 when: job_result.json.TaskState == 'Pending' and job_result.json.Messages.0.Message == 'Task successfully scheduled.'
67 delegate_to: localhost
68
69 - name: Update the firmware from a single executable with job tracking till completion.
70 ansible.builtin.uri:
71 url: "https://{{ baseuri }}{{ result.task.uri }}"
72 user: "{{ username }}"
73 password: "{{ password }}"
74 method: "GET"
75 use_proxy: true
76 status_code: 200, 202
77 return_content: true
78 validate_certs: false
79 force_basic_auth: true
80 headers:
81 Content-Type: "application/json"
82 Accept: "application/json"
83 register: final_result
84 until: final_result.json.TaskState == 'Completed'
85 retries: "{{ retries_count }}"
86 delay: "{{ polling_interval }}"
87 delegate_to: localhost
88
89 - name: Update the firmware from a single executable fact.
90 ansible.builtin.set_fact:
91 job_details: "{{ final_result.json }}"
92 failed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus != "OK"
93 changed_when: final_result.json.TaskState == "Completed" and final_result.json.TaskStatus == "OK"