geerlingguy/ansible-role-certbot

Starting tasks as a handler allows for more flexibility?

basictheprogram opened this issue · 2 comments

Won't starting the web service in a handler allow for more flexibility?

I'm looking at the start services after cert has been generated. in tasks/create-cert-standalone.yml.

I've run into a catch-22.

The playbook I am working on I need the certificates generated but the apache service cannot be started yet. I need to do some additional configuring of apache. When this role attempts to start the apache service the service fails because my apache role (configuration) has not run yet.

If I move my apache role before the certbot role the apache server fails to start because the certificates have not been created.

Something like

handlers/main.yml

- name: Start services after cert has been generated.
  service:
    name: "{{ item }}"
    state: started
  with_items: "{{ certbot_create_standalone_stop_services }}"

tasks/create-cert-standalone.yml

- name: Generate new certificate if one doesn't exist.
  command: "{{ certbot_create_command }}"
  notify:
    - Start services after cert has been generated.
  when: not letsencrypt_cert.stat.exists
stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.