diff --git a/tasks/create-cert-nginx.yml b/tasks/create-cert-nginx.yml new file mode 100644 index 0000000..7038b8d --- /dev/null +++ b/tasks/create-cert-nginx.yml @@ -0,0 +1,9 @@ +--- +- name: Check if certificate already exists. + stat: + path: /etc/letsencrypt/live/{{ cert_item.domains | first }}/cert.pem + register: letsencrypt_cert + +- name: Generate new certificate if one doesn't exist. + command: "{{ certbot_create_command }}" + when: not letsencrypt_cert.stat.exists