This commit is contained in:
parent
9e135e1dfd
commit
4a57dad8a6
2 changed files with 11 additions and 17 deletions
8
roles/certbot/handlers/main.yml
Normal file
8
roles/certbot/handlers/main.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
- name: Reload nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: Generate certificates
|
||||
shell: "certbot certonly --non-interactive --config /etc/letsencrypt/conf.d/{{ certbot.certname }}.ini"
|
|
@ -20,20 +20,6 @@
|
|||
src: "letsencrypt/conf.d/certname.ini.j2"
|
||||
dest: "/etc/letsencrypt/conf.d/{{ certbot.certname }}.ini"
|
||||
mode: 0644
|
||||
register: certbot_config
|
||||
|
||||
- name: Stop services to allow certbot to generate a cert.
|
||||
service:
|
||||
name: nginx
|
||||
state: stopped
|
||||
when: certbot_config.changed
|
||||
|
||||
- name: Generate new certificate if the configuration changed
|
||||
shell: "certbot certonly --non-interactive --config /etc/letsencrypt/conf.d/{{ certbot.certname }}.ini"
|
||||
when: certbot_config.changed
|
||||
|
||||
- name: Restart services to allow certbot to generate a cert.
|
||||
service:
|
||||
name: nginx
|
||||
state: started
|
||||
when: certbot_config.changed
|
||||
notify:
|
||||
- Generate certificates
|
||||
- Reload nginx
|
||||
|
|
Loading…
Reference in a new issue