diff --git a/roles/mail_certificates/handlers/main.yml b/roles/mail_certificates/handlers/main.yml new file mode 100644 index 0000000..cc3f463 --- /dev/null +++ b/roles/mail_certificates/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: Generate certificates + command: "certbot certonly --non-interactive --config /etc/letsencrypt/conf.d/{{ certbot.certname }}.ini" diff --git a/roles/mail_certificates/tasks/main.yml b/roles/mail_certificates/tasks/main.yml index 76f4b9c..2a4e30f 100644 --- a/roles/mail_certificates/tasks/main.yml +++ b/roles/mail_certificates/tasks/main.yml @@ -21,8 +21,4 @@ src: "conf.ini.j2" dest: "/etc/letsencrypt/conf.d/{{ certbot.certname }}.ini" mode: 0644 - register: certbot_config - -- name: Generate new certificates if the configuration changed - command: "certbot certonly --non-interactive --config /etc/letsencrypt/conf.d/{{ certbot.certname }}.ini" - when: certbot_config.changed + notify: Generate certificates