Allow for certificates to be expanded to include new domains

pull/208/head
theS1LV3R 9 months ago
parent 4be771f12a
commit 63638f4471
No known key found for this signature in database
GPG Key ID: 1DF76CB829DAE8D4
  1. 2
      defaults/main.yml
  2. 8
      tasks/create-cert-standalone.yml
  3. 8
      tasks/create-cert-webroot.yml

@ -14,6 +14,7 @@ certbot_hsts: false
certbot_create_if_missing: false
certbot_create_method: standalone
certbot_admin_email: email@example.com
certbot_expand: false
# Default webroot, overwritten by individual per-cert webroot directories
certbot_webroot: /var/www/letsencrypt
@ -33,6 +34,7 @@ certbot_create_command: >-
{{ '--test-cert' if certbot_testmode else '' }}
--noninteractive --agree-tos
--email {{ cert_item.email | default(certbot_admin_email) }}
{{ '--expand' if certbot_expand else '' }}
{{ '--webroot-path ' if certbot_create_method == 'webroot' else '' }}
{{ cert_item.webroot | default(certbot_webroot) if certbot_create_method == 'webroot' else '' }}
{{ certbot_create_extra_args }}

@ -1,9 +1,4 @@
---
- name: Check if certificate already exists.
stat:
path: /etc/letsencrypt/live/{{ cert_item.domains | first | replace('*.', '') }}/cert.pem
register: letsencrypt_cert
- name: Ensure pre and post hook folders exist.
file:
path: /etc/letsencrypt/renewal-hooks/{{ item }}
@ -39,4 +34,5 @@
- name: Generate new certificate if one doesn't exist.
command: "{{ certbot_create_command }}"
when: not letsencrypt_cert.stat.exists
register: certbot_create
changed_when: "'no action taken' not in certbot_create.stdout"

@ -1,9 +1,4 @@
---
- name: Check if certificate already exists.
stat:
path: /etc/letsencrypt/live/{{ cert_item.domains | first }}/cert.pem
register: letsencrypt_cert
- name: Create webroot directory if it doesn't exist yet
file:
path: "{{ cert_item.webroot | default(certbot_webroot) }}"
@ -11,4 +6,5 @@
- name: Generate new certificate if one doesn't exist.
command: "{{ certbot_create_command }}"
when: not letsencrypt_cert.stat.exists
register: certbot_create
changed_when: "'no action taken' not in certbot_create.stdout"

Loading…
Cancel
Save