Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CTC-10559/converge.yml

raw symbols SCIP
1 ---
2 - name: Converge
3 hosts: all
4 gather_facts: false
5 vars:
6 ca_cert_path: "{{ lookup('env', 'ca_cert_path') }}"
7 ctc_cert_name: "{{ lookup('env', 'ctc_cert_name') }}"
8 import_cert_path: "{{ lookup('env', 'path_for_import_cert') }}"
9 export_cert_path: "{{ lookup('env', 'path_for_export_cert') }}"
10
11 tasks:
12 - name: Fetching CTC certificate from share
13 ansible.builtin.include_tasks:
14 file: ../__get_helper.yml
15 vars:
16 idrac_cert_name:
17 - "{{ ctc_cert_name }}"
18
19 - name: Import CTC certificate
20 ansible.builtin.import_role:
21 name: dellemc.openmanage.idrac_certificate
22 vars:
23 hostname: "{{ lookup('env', 'IDRAC_IP') }}"
24 username: "{{ lookup('env', 'IDRAC_USER') }}"
25 password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
26 validate_certs: false
27 command: "import"
28 certificate_type: "CLIENT_TRUST_CERTIFICATE"
29 certificate_path: "{{ import_cert_path }}{{ ctc_cert_name }}"
30
31 - name: Waiting for idrac readiness
32 ansible.builtin.wait_for:
33 timeout: 30
34 when:
35 - not ansible_check_mode
36 - idrac_certificate_out is defined
37 - idrac_certificate_out.changed
38
39 - name: Asserting operation with check mode.
40 ansible.builtin.assert:
41 that: idrac_certificate_out.msg == "Changes found to be applied."
42 when: ansible_check_mode
43
44 - name: Asserting operation with Normal/Idempotence mode.
45 ansible.builtin.assert:
46 that: idrac_certificate_out.msg == "Successfully performed the
47 'import' certificate operation.iDRAC
48 has been reset successfully."
49 when: not ansible_check_mode and idrac_certificate_out.changed
50
51 - name: Export CTC certificate
52 ansible.builtin.import_role:
53 name: dellemc.openmanage.idrac_certificate
54 vars:
55 hostname: "{{ lookup('env', 'IDRAC_IP') }}"
56 username: "{{ lookup('env', 'IDRAC_USER') }}"
57 password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
58 validate_certs: false
59 command: "export"
60 certificate_type: "CLIENT_TRUST_CERTIFICATE"
61 certificate_path: "{{ export_cert_path }}"
62 when: not ansible_check_mode
63
64 - name: Setting up CTC certificate path for exported file
65 when: idrac_certificate_out is defined
66 and idrac_certificate_out.certificate_path is defined
67 ansible.builtin.stat:
68 path: "{{ idrac_certificate_out.certificate_path }}"
69 register: ctc_cert_file
70 no_log: true
71
72 - name: Asserting operation with Normal/Idempotence mode
73 ansible.builtin.assert:
74 that:
75 - ctc_cert_file.stat.exists
76 - not idrac_certificate_out.changed
77 - not idrac_certificate_out.failed
78 - idrac_certificate_out.msg == "Successfully performed the
79 'export' certificate operation."
80 when: not ansible_check_mode and not idrac_certificate_out.changed
81
82 - name: Deleting the directory
83 ansible.builtin.include_tasks:
84 file: ../__delete_directory.yml