Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/bios-10623/converge.yml

raw symbols SCIP
1 ---
2 - name: Converge idrac gather facts for bios
3 hosts: all
4 gather_facts: false
5 vars:
6 hostname: "{{ lookup('env', 'IDRAC_IP') }}"
7 username: "{{ lookup('env', 'IDRAC_USER') }}"
8 password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
9 idrac_port: "{{ lookup('env', 'IDRAC_PORT') }}"
10 validate_certs: false
11 target:
12 - BIOS
13 idrac_gather_facts_uri_method: "GET"
14 idrac_gather_facts_uri_headers:
15 Accept: "application/json"
16 Content-Type: "application/json"
17 OData-Version: "4.0"
18 idrac_gather_facts_uri_body_format: "json"
19 idrac_gather_facts_uri_status_code:
20 - 200
21 - 400
22 - 401
23 - 404
24 - -1
25 idrac_gather_facts_uri_return_content: true
26 diff_data: {}
27 exclude_keys: []
28
29 tasks:
30
31 - name: Find the system API
32 ansible.builtin.include_tasks:
33 ../../tests/asserts/_check_system_url.yml
34
35 - name: Gather Facts for the BIOS component
36 ansible.builtin.include_role:
37 name: "idrac_gather_facts"
38
39 - name: Assert bios dict for length
40 ansible.builtin.assert:
41 that:
42 - "{{ bios | length > 0 }}"
43
44 - name: Fetching BIOS info
45 ansible.builtin.uri:
46 url: "https://{{ hostname }}{{ api_system }}/Bios"
47 validate_certs: false
48 method: "{{ idrac_gather_facts_uri_method }}"
49 user: "{{ username }}"
50 password: "{{ password }}"
51 headers: "{{ idrac_gather_facts_uri_headers }}"
52 body_format: "{{ idrac_gather_facts_uri_body_format }}"
53 status_code: "{{ idrac_gather_facts_uri_status_code }}"
54 return_content: "{{ idrac_gather_facts_uri_return_content }}"
55 register: bios_result
56 no_log: false
57
58 - name: Response filter
59 ansible.builtin.set_fact:
60 api_response:
61 "{{ bios_result.json | ansible.utils.remove_keys(target=['@odata.context',
62 '@odata.type', '@odata.id', 'SettingsObject', 'Actions', 'AttributeRegistry', 'Description',
63 'Id', 'Links', 'Name']) }}"
64 vars:
65 jquery: "Oem.Dell.DellSystem"
66
67 - name: Set the keys diff
68 ansible.builtin.set_fact:
69 diff_keys: "{{ bios.keys() | list | symmetric_difference((api_response.keys() | list)) }}"
70
71 - name: Set a diff of dict
72 ansible.builtin.set_fact:
73 diff_data: "{{ diff_data | combine({item: bios[item]}) }}"
74 loop: "{{ bios.keys() }}"
75 when:
76 - diff_keys | length == 0
77 - bios[item] != api_response[item]
78 - item not in exclude_keys
79
80 - name: Assert the difference in Keys
81 ansible.builtin.assert:
82 that:
83 - "{{ (diff_keys | length) == 0 }}"
84 - "{{ (diff_data | length) == 0 }}"
85 fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
86 success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"