diff --git a/README.md b/README.md index 7bd7cc1..e3055f5 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/defaults/main.yml b/defaults/main.yml index 74084b6..022949d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/renew-cron.yml b/tasks/renew-cron.yml index 394a30e..a7697d1 100644 --- a/tasks/renew-cron.yml +++ b/tasks/renew-cron.yml @@ -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 }}"