From 524527ef9da5d64c0f04f70c1f67215967d242a8 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 20 Dec 2023 13:41:28 +0100 Subject: x509: make ca-certificates accessable for role users --- roles/x509/acmetool/cert/prepare/tasks/main.yml | 1 + roles/x509/acmetool/cert/prepare/templates/reload.sh.j2 | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'roles/x509/acmetool/cert') diff --git a/roles/x509/acmetool/cert/prepare/tasks/main.yml b/roles/x509/acmetool/cert/prepare/tasks/main.yml index 62f34d01..f750c5fe 100644 --- a/roles/x509/acmetool/cert/prepare/tasks/main.yml +++ b/roles/x509/acmetool/cert/prepare/tasks/main.yml @@ -42,6 +42,7 @@ x509_certificate_path_cert: "/var/lib/acme/live/{{ acmetool_cert_hostnames[0] }}/cert" x509_certificate_path_chain: "/var/lib/acme/live/{{ acmetool_cert_hostnames[0] }}/chain" x509_certificate_path_fullchain: "/var/lib/acme/live/{{ acmetool_cert_hostnames[0] }}/fullchain" + x509_certificate_path_ca_cert: "" - name: setup custom renewal script when: x509_certificate_renewal is defined diff --git a/roles/x509/acmetool/cert/prepare/templates/reload.sh.j2 b/roles/x509/acmetool/cert/prepare/templates/reload.sh.j2 index d707357b..8e1c00c6 100644 --- a/roles/x509/acmetool/cert/prepare/templates/reload.sh.j2 +++ b/roles/x509/acmetool/cert/prepare/templates/reload.sh.j2 @@ -18,7 +18,10 @@ while read name; do {% for file in x509_certificate_renewal.install %} install{% if 'mode' in file %} -m {{ file.mode }}{% endif %}{% if 'owner' in file %} -o {{ file.owner }}{% endif %}{% if 'group' in file %} -g {{ file.group }}{% endif %} /dev/null "{{ file.dest }}.new" {% for src in file.src %} - cat "{{ hostvars[inventory_hostname]['x509_certificate_path_' + src] }}" >> "{{ file.dest }}.new" +{% set src_file = lookup('vars', 'x509_certificate_path_' + src) %} +{% if src_file != "" %} + cat "{{ src_file }}" >> "{{ file.dest }}.new" +{% endif %} {% endfor %} mv "{{ file.dest }}.new" "{{ file.dest }}" {% endfor %} -- cgit v1.2.3