Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor-10625/converge.yml

raw symbols SCIP
1 ---
2 - name: Converge idrac_gather_facts for Presence and Status Sensor
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 - PresenceAndStatusSensor
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: Set url1 part1 and part2
36 ansible.builtin.set_fact:
37 url1_1: "https://{{ hostname }}{{ api_system }}"
38 url1_2: "/Oem/Dell/DellPresenceAndStatusSensors"
39
40 - name: Set url1
41 ansible.builtin.set_fact:
42 url1: "{{ url1_1 }}{{ url1_2 }}"
43
44 - name: Fetching Presence and Status Sensor info
45 ansible.builtin.uri:
46 url: "{{ url1 }}"
47 validate_certs: "{{ validate_certs }}"
48 ca_path: "{{ ca_path | default(omit) }}"
49 method: "{{ idrac_gather_facts_uri_method }}"
50 user: "{{ username }}"
51 password: "{{ password }}"
52 headers: "{{ idrac_gather_facts_uri_headers }}"
53 body_format: "{{ idrac_gather_facts_uri_body_format }}"
54 status_code: "{{ idrac_gather_facts_uri_status_code }}"
55 return_content: "{{ idrac_gather_facts_uri_return_content }}"
56 no_log: false
57 register: passensor_result
58
59 - name: Set presence and status sensor facts
60 ansible.builtin.set_fact:
61 api_response: "{{ passensor_result.json.Members |
62 ansible.utils.remove_keys(target=['@odata.context',
63 '@odata.id', '@odata.type', '@odata.etag', 'Assembly', 'Links']) }}"
64 when: passensor_result is defined and passensor_result.json.Members
65 is defined
66
67 - name: Gather Facts for the Presence and Status Sensor
68 ansible.builtin.include_role:
69 name: "idrac_gather_facts"
70
71 - name: Assert Presence and Status Sensor data
72 ansible.builtin.assert:
73 that:
74 - "((api_response | length == 0) and
75 (presence_and_status_sensor | length == 0))"
76 fail_msg: "The response from the role does not match"
77 success_msg: "The response from the role matches"
78 when: api_response is defined and api_response | length == 0
79
80 - name: Check whether output differs
81 ansible.builtin.set_fact:
82 result_diff: "{{ presence_and_status_sensor |
83 symmetric_difference(api_response) }}"
84 when: api_response is defined and api_response | length > 0
85
86 - name: Assert the differences in List
87 ansible.builtin.assert:
88 fail_msg: "The response from the role does not match"
89 success_msg: "The response from the role matches"
90 that:
91 - (result_diff | length) == 0
92 when: api_response is defined and api_response | length > 0