Skip to content

Commit 464cca2

Browse files
committed
feat: refactor copy-ca-to-hosts playbook
The playbook `copy-ca-to-hosts` has been refactored in a couple ways. Firstly, the tasks for installing in either `RHEL` or `Debian` based systems are placed in `blocks`. Secondly both the root and intermediate certificate authority have added here to ensure the full chain is available if required.
1 parent 27410af commit 464cca2

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed
Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
---
2-
- name: Copy CA certificate and update trust
2+
- name: Install certificate authorities and update trust
33
hosts: overcloud:seed:seed-hypervisor
44
become: true
5-
vars:
6-
cert_path: "{{ kayobe_env_config_path }}/vault/OS-TLS-ROOT.pem"
7-
85
tasks:
9-
- name: Copy certificate on RedHat family systems (Rocky, RHEL, CentOS)
10-
ansible.builtin.copy:
11-
src: "{{ cert_path }}"
12-
dest: "/etc/pki/ca-trust/source/anchors/OS-TLS-ROOT.pem"
13-
mode: "0644"
6+
- name: Install certificate authorities on RedHat based distributions
147
when: ansible_facts.os_family == 'RedHat'
8+
block:
9+
- name: Copy certificate authorities on RedHat family systems (Rocky, RHEL, CentOS)
10+
ansible.builtin.copy:
11+
src: "{{ kayobe_env_config_path }}/openbao/{{ item }}.pem"
12+
dest: "/etc/pki/ca-trust/source/anchors/{{ item }}.crt"
13+
mode: "0644"
14+
loop:
15+
- "OS-TLS-ROOT"
16+
- "OS-TLS-INT"
1517

16-
- name: Update CA trust on RedHat family systems
17-
ansible.builtin.command: "update-ca-trust"
18-
when: ansible_facts.os_family == 'RedHat'
18+
- name: Update CA trust on RedHat family systems
19+
ansible.builtin.command: "update-ca-trust"
1920

20-
- name: Copy certificate on Debian family systems (Ubuntu, Debian)
21-
ansible.builtin.copy:
22-
src: "{{ cert_path }}"
23-
dest: "/usr/local/share/ca-certificates/OS-TLS-ROOT.crt"
24-
mode: "0644"
21+
- name: Install certificate authorities on Debian based distributions
2522
when: ansible_facts.os_family == 'Debian'
23+
block:
24+
- name: Copy certificate authorities on Debian family systems (Ubuntu, Debian)
25+
ansible.builtin.copy:
26+
src: "{{ kayobe_env_config_path }}/openbao/{{ item }}.pem"
27+
dest: "/usr/local/share/ca-certificates/{{ item }}.crt"
28+
mode: "0644"
29+
loop:
30+
- "OS-TLS-ROOT"
31+
- "OS-TLS-INT"
2632

27-
- name: Update CA trust on Debian family systems
28-
ansible.builtin.command: "update-ca-certificates"
29-
when: ansible_facts.os_family == 'Debian'
33+
- name: Update CA trust on Debian family systems
34+
ansible.builtin.command: "update-ca-certificates"

0 commit comments

Comments
 (0)