Debian Codegraph @

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

raw symbols SCIP
1 ---
2 - name: Get controller id
3 ansible.builtin.set_fact:
4 ctrl_id: "{{ virtualdisk_data.Id | split(':') | last }}"
5
6 - name: Get Storage information.
7 ansible.builtin.uri:
8 url: "https://{{ hostname }}{{ api_system }}/Storage/{{ ctrl_id }}/Volumes/{{ virtualdisk_data.Id }}"
9 validate_certs: "{{ validate_certs }}"
10 ca_path: "{{ ca_path | default(omit) }}"
11 method: "{{ idrac_gather_facts_uri_method }}"
12 user: "{{ username }}"
13 password: "{{ password }}"
14 headers: "{{ idrac_gather_facts_uri_headers }}"
15 body_format: "{{ idrac_gather_facts_uri_body_format }}"
16 status_code: "{{ idrac_gather_facts_uri_status_code }}"
17 return_content: "{{ idrac_gather_facts_uri_return_content }}"
18 no_log: true
19 register: virtualdisk_result
20
21 - name: Filter Virtual Disk data
22 ansible.builtin.set_fact:
23 api_response: "{{ virtualdisk_result.json | ansible.utils.remove_keys(target=['@odata.context', '@odata.type', '@odata.id', 'Actions',
24 '[email protected]', '[email protected]', 'Links', '[email protected]', 'DellVirtualDisk', '[email protected]']) }}"
25
26 - name: Set the keys diff
27 ansible.builtin.set_fact:
28 diff_keys: "{{ virtualdisk_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}"
29
30 - name: Set a Diff of dict
31 ansible.builtin.set_fact:
32 diff_data: "{{ diff_data | combine({item: virtualdisk_data[item]}) }}"
33 loop: "{{ virtualdisk_data.keys() }}"
34 when:
35 - diff_keys | length == 0
36 - virtualdisk_data[item] != api_response[item]
37 - item not in exclude_keys
38
39 - name: Assert the difference in Keys
40 ansible.builtin.assert:
41 that:
42 - "{{ (diff_keys | length) == 0 }}"
43 - "{{ (diff_data | length) == 0 }}"
44 fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
45 success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"