From 35ceee9f1b5ff2e71d6f90db61ef10b0a980e54c Mon Sep 17 00:00:00 2001 From: exploide Date: Thu, 23 Feb 2017 20:00:42 +0100 Subject: [PATCH] restructured tasks such that subtask files are included this is a preparation for installing certbot from package management additionally, it might be useful when further tasks are added, e.g. for initial certificate retrieval --- tasks/install-from-git.yml | 13 +++++++++++++ tasks/main.yml | 21 ++------------------- tasks/renew-cron.yml | 8 ++++++++ 3 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 tasks/install-from-git.yml create mode 100644 tasks/renew-cron.yml 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 }}"