Merge pull request 'Certbot: handlers' (#1) from handlers into master
Some checks failed
continuous-integration/drone/push Build is failing

Reviewed-on: Aurore/ansible#1
This commit is contained in:
otthorn 2021-01-20 17:00:32 +01:00
commit 724d21485c
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
command: "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"
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