Allow overriding which cron file gets updated

This commit is contained in:
Márton Salomváry 2020-05-29 11:02:05 +02:00
parent 24580c85d2
commit 1fd8df7e9f
3 changed files with 4 additions and 0 deletions

View File

@ -22,6 +22,8 @@ The variables `certbot_install_from_source` and `certbot_install_with_package` c
By default, this role configures a cron job to run under the provided user account at the given hour and minute, every day. The defaults run `certbot renew` (or `certbot-auto renew`) via cron every day at 03:30:00 by the user you use in your Ansible playbook. It's preferred that you set a custom user/hour/minute so the renewal is during a low-traffic period and done by a non-root user account.
Use the `certbot_auto_renew_cron_file` to override [which cron file](https://docs.ansible.com/ansible/latest/modules/cron_module.html#parameter-cron_file) gets updated. Defaults to empty, which means using the user's crontab.
### Automatic Certificate Generation
Currently there is one built-in method for generating new certificates using this role: `standalone`. Other methods (e.g. using nginx or apache and a webroot) may be added in the future.

View File

@ -5,6 +5,7 @@ certbot_auto_renew_user: "{{ ansible_user | default(lookup('env', 'USER')) }}"
certbot_auto_renew_hour: "3"
certbot_auto_renew_minute: "30"
certbot_auto_renew_options: "--quiet --no-self-upgrade"
certbot_auto_renew_cron_file:
# Parameters used when creating new Certbot certs.
certbot_etc: /etc/letsencrypt

View File

@ -2,6 +2,7 @@
- name: Add cron job for certbot renewal (if configured).
cron:
name: Certbot automatic renewal.
cron_file: "{{ certbot_auto_renew_cron_file }}"
job: "{{ certbot_script }} renew {{ certbot_auto_renew_options }}"
minute: "{{ certbot_auto_renew_minute }}"
hour: "{{ certbot_auto_renew_hour }}"