Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics-10669/converge.yml

raw symbols SCIP
1 ---
2 - name: Converge idrac_gather_facts for Power Supply
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 - SystemMetrics
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 chassis API
32 ansible.builtin.include_tasks:
33 ../../tests/asserts/_check_chassis_url.yml
34
35 - name: Gather Facts for the System Metrics component
36 ansible.builtin.include_role:
37 name: "idrac_gather_facts"
38
39 - name: Call assertion for thermal metrics
40 ansible.builtin.include_tasks: ../../tests/asserts/tmetrics_assert.yml
41
42 - name: Call assertion for memory metrics
43 ansible.builtin.include_tasks: ../../tests/asserts/mmetrics_assert.yml
44
45 - name: Get Power Supply information.
46 ansible.builtin.uri:
47 url: "https://{{ hostname }}{{ api_chassis }}/PowerSubsystem/PowerSupplies?$expand=*($levels=1)"
48 validate_certs: "{{ validate_certs }}"
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 register: response_power_supply
57 ignore_errors: true
58 no_log: false
59
60 - name: Get Power Supply Metrics ids
61 ansible.builtin.set_fact:
62 psu_ids: "{{ power_result.json.Members | map(attribute='Id') | list }}"
63 when: power_result.status == 200
64
65 - name: Assert Power Supply Metrics metrics
66 ansible.builtin.assert:
67 that:
68 - "((psu_ids | length == 0) and (power_metrics | length == 0))"
69 fail_msg: "The response from the role does not match"
70 success_msg: "The response from the role matches"
71 when: psu_ids is defined and psu_ids | length == 0
72
73 - name: Call assertion for Power metrics
74 ansible.builtin.include_tasks: ../../tests/asserts/psmetrics_assert.yml
75 with_items: "{{ power_metrics }}"
76 loop_control:
77 loop_var: power_data
78 index_var: index
79 when: power_result.status == 200 and psu_ids | length > 0