mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2025-04-19 17:01:37 +02:00
Move services start into a handler
when running temporary invalid nginx configuration
This commit is contained in:
parent
70b33ab511
commit
27aa351bfe
7
handlers/main.yml
Normal file
7
handlers/main.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: start services
|
||||||
|
service:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: started
|
||||||
|
when: not letsencrypt_cert.stat.exists
|
||||||
|
with_items: "{{ certbot_create_standalone_stop_services }}"
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Check if certificate already exists.
|
- name: Check if certificate already exists. ({{ cert_item.domains }})
|
||||||
stat:
|
stat:
|
||||||
path: /etc/letsencrypt/live/{{ cert_item.domains | first | replace('*.', '') }}/cert.pem
|
path: /etc/letsencrypt/live/{{ cert_item.domains | first | replace('*.', '') }}/cert.pem
|
||||||
register: letsencrypt_cert
|
register: letsencrypt_cert
|
||||||
@ -11,13 +11,7 @@
|
|||||||
when: not letsencrypt_cert.stat.exists
|
when: not letsencrypt_cert.stat.exists
|
||||||
with_items: "{{ certbot_create_standalone_stop_services }}"
|
with_items: "{{ certbot_create_standalone_stop_services }}"
|
||||||
|
|
||||||
- name: Generate new certificate if one doesn't exist.
|
- name: Generate new certificate if one doesn't exist. ({{ cert_item.domains }})
|
||||||
command: "{{ certbot_create_command }}"
|
command: "{{ certbot_create_command }}"
|
||||||
when: not letsencrypt_cert.stat.exists
|
when: not letsencrypt_cert.stat.exists
|
||||||
|
notify: start services
|
||||||
- name: Start services after cert has been generated.
|
|
||||||
service:
|
|
||||||
name: "{{ item }}"
|
|
||||||
state: started
|
|
||||||
when: not letsencrypt_cert.stat.exists
|
|
||||||
with_items: "{{ certbot_create_standalone_stop_services }}"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user