Debian Codegraph @

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

raw symbols SCIP
1 ---
2 - name: Fetching Secureboot info
3 ansible.builtin.uri: &uri_params
4 url: "https://{{ hostname }}{{ api_system
5 }}/SecureBoot/?$expand=*($levels=1)"
6 validate_certs: "{{ validate_certs }}"
7 ca_path: "{{ ca_path | default(omit) }}"
8 method: "{{ idrac_gather_facts_uri_method }}"
9 user: "{{ username }}"
10 password: "{{ password }}"
11 headers: "{{ idrac_gather_facts_uri_headers }}"
12 body_format: "{{ idrac_gather_facts_uri_body_format }}"
13 status_code: "{{ idrac_gather_facts_uri_status_code }}"
14 return_content: "{{ idrac_gather_facts_uri_return_content }}"
15 register: idrac_gather_facts_secureboot_details
16
17 - name: Fetching Secureboot database info
18 ansible.builtin.uri:
19 url: "https://{{ hostname }}{{ api_system
20 }}/SecureBoot/SecureBootDatabases?$expand=*($levels=1)"
21 <<: *uri_params
22 register: idrac_gather_facts_secureboot_database_details
23
24 - name: Fetching Secureboot database certificates info
25 ansible.builtin.uri:
26 url: "https://{{ hostname }}{{
27 sec_boot_db_item['Certificates']['@odata.id'] }}
28 ?$expand=*($levels=1)"
29 <<: *uri_params
30 loop: "{{ idrac_gather_facts_secureboot_database_details.json.Members }}"
31 loop_control:
32 loop_var: sec_boot_db_item
33 register: idrac_gather_facts_secure_boot_results
34
35 - name: Combine certificates with corresponding database information.
36 ansible.builtin.set_fact:
37 interim_secure_boot: "{{ interim_secure_boot | default([]) +
38 [sec_boot_cert['sec_boot_db_item'] | combine({'Certificates':
39 sec_boot_cert['json']['Members']})] }}"
40 loop: "{{ secure_boot_results.results }}"
41 loop_control:
42 loop_var: sec_boot_cert
43 no_log: true
44
45 - name: Combine the secure boot database and certificates into secure boot.
46 ansible.builtin.set_fact:
47 api_response: '{{ idrac_gather_facts_secureboot_details.json |
48 combine({"SecureBootDatabases":
49 interim_secure_boot}) |
50 ansible.utils.remove_keys(target=["^.*@odata\..*$"],
51 matching_parameter="regex") }}'
52
53 - name: Check whether output differs
54 ansible.builtin.set_fact:
55 result_diff: "{{ secure_boot | symmetric_difference(api_response) }}"
56
57 - name: Assert the differences in List
58 ansible.builtin.assert:
59 fail_msg: "The response from the role does not match"
60 success_msg: "The response from the role matches"
61 that:
62 - "{{ (result_diff | length) == 0 }}"