mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2025-04-19 17:01:37 +02:00
Added method webroot to avoid restarting servers
This commit is contained in:
parent
00dc226101
commit
993e742d5c
@ -36,3 +36,4 @@ certbot_keep_updated: true
|
|||||||
|
|
||||||
# Where to put Certbot when installing from source.
|
# Where to put Certbot when installing from source.
|
||||||
certbot_dir: /opt/certbot
|
certbot_dir: /opt/certbot
|
||||||
|
certbot_webroot: /var/www/letsencrypt
|
||||||
|
13
tasks/create-cert-webroot.yml
Normal file
13
tasks/create-cert-webroot.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
- name: Check if certificate already exists.
|
||||||
|
stat:
|
||||||
|
path: /etc/letsencrypt/live/{{ cert_item.domains | first | replace('*.', '') }}/cert.pem
|
||||||
|
register: letsencrypt_cert
|
||||||
|
|
||||||
|
- name: Override certbot command variable to use webroot
|
||||||
|
include_vars: "webroot.yml"
|
||||||
|
when: not letsencrypt_cert.stat.exists
|
||||||
|
|
||||||
|
- name: Generate new certificate if one doesn't exist.
|
||||||
|
command: "{{ certbot_create_command }}"
|
||||||
|
when: not letsencrypt_cert.stat.exists
|
@ -15,5 +15,13 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
loop_var: cert_item
|
loop_var: cert_item
|
||||||
|
|
||||||
|
- include_tasks: create-cert-webroot.yml
|
||||||
|
with_items: "{{ certbot_certs }}"
|
||||||
|
when:
|
||||||
|
- certbot_create_if_missing
|
||||||
|
- certbot_create_method == 'webroot'
|
||||||
|
loop_control:
|
||||||
|
loop_var: cert_item
|
||||||
|
|
||||||
- import_tasks: renew-cron.yml
|
- import_tasks: renew-cron.yml
|
||||||
when: certbot_auto_renew
|
when: certbot_auto_renew
|
||||||
|
7
vars/webroot.yml
Normal file
7
vars/webroot.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
certbot_create_command: >-
|
||||||
|
{{ certbot_script }} certonly --webroot
|
||||||
|
--webroot-path {{ certbot_webroot }}
|
||||||
|
--noninteractive --agree-tos
|
||||||
|
--email {{ cert_item.email | default(certbot_admin_email) }}
|
||||||
|
-d {{ cert_item.domains | join(',') }}
|
Loading…
x
Reference in New Issue
Block a user