The update command ran on every play with changed_when tied to its return code, so the role never reported a converged state. It is a handler now, notified by the anchor symlink and by the three tasks which write cert.pem of the root certificate authority. Notifying from the certificate tasks as well keeps the trust store correct on renewal, where the symlink itself stays untouched. The anchor path and the update command moved into the per os_family vars, because a handler cannot read the block vars they lived in before. Debian and RedHat need dedicated files again, they agree on the package name but differ in anchor path, file extension and update command. Co-authored-by: Copilot <copilot@github.com>
21 lines
720 B
YAML
21 lines
720 B
YAML
---
|
|
|
|
- name: Import private key of root Certificate Authority (CA)
|
|
ansible.builtin.copy:
|
|
content: "{{ certificate_authority_root_ca_tls_key_content }}"
|
|
dest: "{{ certificate_authority_root_ca_path }}/privkey.pem"
|
|
owner: root
|
|
group: root
|
|
mode: "0600"
|
|
when: certificate_authority_root_ca_tls_key_content | length > 0
|
|
|
|
- name: Import certificate of root Certificate Authority (CA)
|
|
ansible.builtin.copy:
|
|
content: "{{ certificate_authority_root_ca_tls_crt_content }}"
|
|
dest: "{{ certificate_authority_root_ca_path }}/cert.pem"
|
|
owner: "root"
|
|
group: "root"
|
|
mode: "0644"
|
|
notify: Update systems SSL/TLS trust store
|
|
when: certificate_authority_root_ca_tls_crt_content | length > 0
|