summaryrefslogtreecommitdiff
path: root/roles/x509/acmetool
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2023-12-20 13:41:28 +0100
committerChristian Pointner <equinox@spreadspace.org>2023-12-20 13:41:28 +0100
commit524527ef9da5d64c0f04f70c1f67215967d242a8 (patch)
tree0697689dda5ae56ba74ac8551eeab37f446b9c95 /roles/x509/acmetool
parentx509: add new role managed-ca (diff)
x509: make ca-certificates accessable for role users
Diffstat (limited to 'roles/x509/acmetool')
-rw-r--r--roles/x509/acmetool/cert/prepare/tasks/main.yml1
-rw-r--r--roles/x509/acmetool/cert/prepare/templates/reload.sh.j25
2 files changed, 5 insertions, 1 deletions
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 %}