ansible-role-certbot/tasks/renew-cron.yml
Kristian Rønningen 244d6d739f Allow renew-cron to remove cronjob if it was added earlier
If the `certbot_auto_renew` variable was `True`, and the cronjob was
added, setting it to `False` would not remove it. By always including
the `renew-cron.yml` task file, and instead checking the
`certbot_auto_renew` value there, and pick a value for `state` based on
it, we can clean up a cronjob if it is no longer wanted.
2018-12-04 11:55:25 +01:00

10 lines
373 B
YAML

---
- name: Add cron job for certbot renewal (if configured).
cron:
name: Certbot automatic renewal.
job: "{{ certbot_script }} renew {{ certbot_auto_renew_options }}"
minute: "{{ certbot_auto_renew_minute }}"
hour: "{{ certbot_auto_renew_hour }}"
user: "{{ certbot_auto_renew_user }}"
state: "{{ 'present' if certbot_auto_renew else 'absent' }}"