Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/CA-10553/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 ca_cert_name: "{{ lookup('env', 'ca_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 CA certificate from share
13 ansible.builtin.include_tasks:
14 file: ../__get_helper.yml
15 vars:
16 idrac_cert_name:
17 - "{{ ca_cert_name }}"
18
19 - name: Import CA 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 reset: false
29 certificate_type: "CA"
30 certificate_path: "{{ import_cert_path }}{{ ca_cert_name }}"
31
32 - name: Waiting for idrac readiness
33 ansible.builtin.wait_for:
34 timeout: 30
35 when:
36 - not ansible_check_mode
37 - idrac_certificate_out is defined
38 - idrac_certificate_out.changed
39
40 - name: Asserting operation with check mode.
41 ansible.builtin.assert:
42 that: idrac_certificate_out.msg == "Changes found to be applied."
43 when: ansible_check_mode
44
45 - name: Asserting operation with Normal/Idempotence mode.
46 ansible.builtin.assert:
47 that: idrac_certificate_out.msg == "Successfully performed the
48 'import' certificate operation.Reset iDRAC to apply the new
49 certificate. Until the iDRAC is reset, the old certificate will
50 remain active."
51 when: not ansible_check_mode and idrac_certificate_out.changed
52
53 - name: Export CA certificate
54 ansible.builtin.import_role:
55 name: dellemc.openmanage.idrac_certificate
56 vars:
57 hostname: "{{ lookup('env', 'IDRAC_IP') }}"
58 username: "{{ lookup('env', 'IDRAC_USER') }}"
59 password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
60 validate_certs: false
61 command: "export"
62 certificate_type: "CA"
63 certificate_path: "{{ export_cert_path }}"
64 when: not ansible_check_mode
65
66 - name: Setting up CA certificate path for exported file
67 when: idrac_certificate_out is defined
68 and idrac_certificate_out.certificate_path is defined
69 ansible.builtin.stat:
70 path: "{{ idrac_certificate_out.certificate_path }}"
71 register: ca_cert_file
72 no_log: true
73
74 - name: Asserting operation with Normal/Idempotence mode
75 ansible.builtin.assert:
76 that:
77 - ca_cert_file.stat.exists
78 - not idrac_certificate_out.changed
79 - not idrac_certificate_out.failed
80 - idrac_certificate_out.msg == "Successfully performed the
81 'export' certificate operation."
82 when: not ansible_check_mode and not idrac_certificate_out.changed
83
84 - name: Deleting the directory
85 ansible.builtin.include_tasks:
86 file: ../__delete_directory.yml