use handlers
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
otthorn 2021-01-19 23:19:25 +01:00
parent 9e135e1dfd
commit 4a57dad8a6
2 changed files with 11 additions and 17 deletions

View 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"

View file

@ -20,20 +20,6 @@
src: "letsencrypt/conf.d/certname.ini.j2" src: "letsencrypt/conf.d/certname.ini.j2"
dest: "/etc/letsencrypt/conf.d/{{ certbot.certname }}.ini" dest: "/etc/letsencrypt/conf.d/{{ certbot.certname }}.ini"
mode: 0644 mode: 0644
register: certbot_config notify:
- Generate certificates
- name: Stop services to allow certbot to generate a cert. - Reload nginx
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