diff --git a/common/docker_traefik/tasks/certificate.yml b/common/docker_traefik/tasks/certificate.yml index b32f1c8af887c0f4be184e71e97e4449f0e60a16..40a41d910ef6a80947382c5b1f047b940e750e73 100644 --- a/common/docker_traefik/tasks/certificate.yml +++ b/common/docker_traefik/tasks/certificate.yml @@ -73,12 +73,26 @@ when: not cert_cert_stat_result.stat.exists - name: "Create ServerCert from CSR" - community.crypto.x509_certificate: - path: "{{ basedir }}/cert.pem" + community.crypto.x509_certificate_pipe: csr_content: "{{ cert_csr.csr }}" provider: ownca ownca_path: "{{ basedir }}/ca.pem" ownca_privatekey_path: "{{ basedir }}/ca.key" ownca_not_after: +9999d # long lifetime ownca_not_before: "-1d" # valid since yesterday + register: cert + when: not cert_cert_stat_result.stat.exists + +- name: "Create ServerCert chain" + community.crypto.certificate_complete_chain: + input_chain: "{{ cert.certificate }}" + root_certificates: + - "{{ basedir }}/ca.pem" + register: cert_chain when: not cert_cert_stat_result.stat.exists + +- name: "Create ServerCert chain" + copy: + dest: "{{ basedir }}/cert.pem" + content: "{{ ''.join(cert_chain.complete_chain) }}" +