Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/hostnic_assert.yml

raw symbols SCIP
1 - name: Fetching HostNIC info
2 ansible.builtin.uri:
3 url: "https://{{ hostname }}{{ api_manager }}/HostInterfaces/{{ hostnic_data.Id }}"
4 validate_certs: "{{ validate_certs }}"
5 ca_path: "{{ ca_path | default(omit) }}"
6 method: "{{ idrac_gather_facts_uri_method }}"
7 user: "{{ username }}"
8 password: "{{ password }}"
9 headers: "{{ idrac_gather_facts_uri_headers }}"
10 body_format: "{{ idrac_gather_facts_uri_body_format }}"
11 status_code: "{{ idrac_gather_facts_uri_status_code }}"
12 return_content: "{{ idrac_gather_facts_uri_return_content }}"
13 register: hostnic_result
14 no_log: false
15
16 - name: Set hostnic facts
17 ansible.builtin.set_fact:
18 api_response: "{{ hostnic_result.json | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type', 'HostEthernetInterfaces',
19 'ManagerEthernetInterface', '@odata.etag']) }}"
20
21 - name: Set the keys diff
22 ansible.builtin.set_fact:
23 diff_keys: "{{ hostnic_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}"
24
25 - name: Set a diff of dict
26 ansible.builtin.set_fact:
27 diff_data: "{{ diff_data | combine({item: hostnic_data[item]}) }}"
28 loop: "{{ hostnic_data.keys() }}"
29 when:
30 - diff_keys | length == 0
31 - hostnic_data[item] != api_response[item]
32 - item not in exclude_keys
33
34 - name: Assert the difference in Keys
35 ansible.builtin.assert:
36 that:
37 - (diff_keys | length) == 0
38 - (diff_data | length) == 0
39 fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
40 success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"