diff options
Diffstat (limited to 'roles/x509/static-ca/cert')
-rw-r--r-- | roles/x509/static-ca/cert/prepare/tasks/main.yml | 6 | ||||
-rw-r--r-- | roles/x509/static-ca/cert/prepare/templates/updated.sh.j2 | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/roles/x509/static-ca/cert/prepare/tasks/main.yml b/roles/x509/static-ca/cert/prepare/tasks/main.yml index 538bb58d..9a8d1bde 100644 --- a/roles/x509/static-ca/cert/prepare/tasks/main.yml +++ b/roles/x509/static-ca/cert/prepare/tasks/main.yml @@ -84,12 +84,18 @@ - restart services for x509 certificates register: _static_ca_cert_ +- name: install CA certificate + copy: + content: "{{ static_ca_cert_config.ca.cert_content }}" + dest: "{{ static_ca_cert_path }}/{{ static_ca_cert_name }}-ca-crt.pem" + - name: export paths to certificate files set_fact: x509_certificate_path_key: "{{ static_ca_cert_path }}/{{ static_ca_cert_name }}-key.pem" x509_certificate_path_cert: "{{ static_ca_cert_path }}/{{ static_ca_cert_name }}-crt.pem" x509_certificate_path_chain: "" x509_certificate_path_fullchain: "{{ static_ca_cert_path }}/{{ static_ca_cert_name }}-crt.pem" + x509_certificate_path_ca_cert: "{{ static_ca_cert_path }}/{{ static_ca_cert_name }}-ca-crt.pem" - name: generate custom post-renewal script when: x509_certificate_renewal is defined diff --git a/roles/x509/static-ca/cert/prepare/templates/updated.sh.j2 b/roles/x509/static-ca/cert/prepare/templates/updated.sh.j2 index f0757832..0842c527 100644 --- a/roles/x509/static-ca/cert/prepare/templates/updated.sh.j2 +++ b/roles/x509/static-ca/cert/prepare/templates/updated.sh.j2 @@ -4,7 +4,10 @@ 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 "{{ lookup('vars', '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 %} |