Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane-10633/converge.yml

raw symbols SCIP
1 ---
2 - name: Converge idrac_gather_facts for PCIeSSDBackPlane
3 hosts: all
4 connection: local
5 gather_facts: true
6 vars:
7 hostname: "{{ lookup('env', 'IDRAC_IP') }}"
8 username: "{{ lookup('env', 'IDRAC_USER') }}"
9 password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
10 idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
11 validate_certs: false
12 target:
13 - PCIeSSDBackPlane
14 idrac_gather_facts_uri_method: "GET"
15 idrac_gather_facts_uri_headers:
16 Accept: "application/json"
17 Content-Type: "application/json"
18 OData-Version: "4.0"
19 idrac_gather_facts_uri_body_format: "json"
20 idrac_gather_facts_uri_status_code:
21 - 200
22 - 400
23 - 401
24 - 404
25 - -1
26 idrac_gather_facts_uri_return_content: true
27
28 tasks:
29
30 - name: Find the chassis API
31 ansible.builtin.include_tasks:
32 ../../tests/asserts/_check_chassis_url.yml
33
34 - name: Set 17G url
35 ansible.builtin.set_fact:
36 url1_1: "https://{{ hostname }}{{ api_chassis }}"
37 url1_2: "/Oem/Dell/DellPCIeSSDBackPlanes"
38 when:
39 - not is_omsdk_required | bool
40
41 - name: Set <17G url
42 ansible.builtin.set_fact:
43 url1_1: "https://{{ hostname }}/redfish/v1/Chassis"
44 url1_2: "/Oem/Dell/DellPCIeSSDBackPlanes"
45 when:
46 - is_omsdk_required | bool
47
48 - name: Set < 17G url
49 ansible.builtin.set_fact:
50 url1: "{{ url1_1 }}{{ url1_2 }}"
51
52 - name: Collecting PCIeSSDBackPlane information from API
53 ansible.builtin.uri:
54 url: "{{ url1 }}"
55 validate_certs: "{{ validate_certs }}"
56 ca_path: "{{ ca_path | default(omit) }}"
57 method: "{{ idrac_gather_facts_uri_method }}"
58 user: "{{ username }}"
59 password: "{{ password }}"
60 headers: "{{ idrac_gather_facts_uri_headers }}"
61 body_format: "{{ idrac_gather_facts_uri_body_format }}"
62 status_code: "{{ idrac_gather_facts_uri_status_code }}"
63 return_content: "{{ idrac_gather_facts_uri_return_content }}"
64 register: backplane_result_url
65 no_log: false
66
67 - name: Set PCIeSSDBackPlane facts
68 ansible.builtin.set_fact:
69 api_response: "{{ backplane_result_url.json.Members | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type']) }}"
70 when: backplane_result_url.status == 200
71
72 - name: Gather Facts for the PCIeSSDBackPlane component
73 ansible.builtin.include_role:
74 name: "idrac_gather_facts"
75
76 - name: Assert backplane data
77 ansible.builtin.assert:
78 that:
79 - "((api_response | length != 0) and (backplane | length != 0))"
80 fail_msg: "The response from the role does not match"
81 success_msg: "The response from the role matches"
82 when: api_response is defined and api_response | length != 0
83
84 - name: Check whether output differs
85 ansible.builtin.set_fact:
86 result_diff: "{{ backplane | symmetric_difference(api_response) }}"
87 when: api_response is defined and api_response | length > 0
88
89 - name: Assert the differences in List
90 ansible.builtin.assert:
91 fail_msg: "The response from the role does not match"
92 success_msg: "The response from the role matches"
93 that:
94 - "{{ (result_diff | length) == 0 }}"
95 when: api_response is defined and api_response | length > 0