diff --git a/tasks/install-from-git.yml b/tasks/install-from-git.yml new file mode 100644 index 0000000..24a3544 --- /dev/null +++ b/tasks/install-from-git.yml @@ -0,0 +1,13 @@ +--- +- name: Clone Certbot into configured directory. + git: + repo: "{{ certbot_repo }}" + dest: "{{ certbot_dir }}" + version: "{{ certbot_version }}" + update: "{{ certbot_keep_updated }}" + force: yes + +- name: Ensure certbot-auto is executable. + file: + path: "{{ certbot_dir }}/certbot-auto" + mode: 0755 diff --git a/tasks/main.yml b/tasks/main.yml index 5e17fb6..27aab86 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,22 +1,5 @@ --- -- name: Clone Certbot into configured directory. - git: - repo: "{{ certbot_repo }}" - dest: "{{ certbot_dir }}" - version: "{{ certbot_version }}" - update: "{{ certbot_keep_updated }}" - force: yes +- include: install-from-git.yml -- name: Ensure certbot-auto is executable. - file: - path: "{{ certbot_dir }}/certbot-auto" - mode: 0755 - -- name: Add cron job for 'certbot-auto renew' (if configured). - cron: - name: Certbot automatic renewal. - job: "{{ certbot_dir }}/certbot-auto renew --quiet --no-self-upgrade" - minute: "{{ certbot_auto_renew_minute }}" - hour: "{{ certbot_auto_renew_hour }}" - user: "{{ certbot_auto_renew_user }}" +- include: renew-cron.yml when: certbot_auto_renew diff --git a/tasks/renew-cron.yml b/tasks/renew-cron.yml new file mode 100644 index 0000000..62ba3bd --- /dev/null +++ b/tasks/renew-cron.yml @@ -0,0 +1,8 @@ +--- +- name: Add cron job for 'certbot-auto renew' (if configured). + cron: + name: Certbot automatic renewal. + job: "{{ certbot_dir }}/certbot-auto renew --quiet --no-self-upgrade" + minute: "{{ certbot_auto_renew_minute }}" + hour: "{{ certbot_auto_renew_hour }}" + user: "{{ certbot_auto_renew_user }}"