added possibility to install certbot from package management

- introduces a variable certbot_from_git
- adds install from package tasks
- makes a variable called certbot_script available (to handle certbot vs certbot-auto naming)
- fixes #18
pull/20/head
exploide 8 years ago
parent 35ceee9f1b
commit f3a260e94e
  1. 3
      defaults/main.yml
  2. 6
      tasks/install-from-git.yml
  3. 7
      tasks/install-from-package.yml
  4. 4
      tasks/main.yml
  5. 4
      tasks/renew-cron.yml

@ -1,10 +1,11 @@
---
# Where to get Certbot.
certbot_from_git: no
certbot_repo: https://github.com/certbot/certbot.git
certbot_version: master
certbot_keep_updated: yes
# Where to put Certbot.
# Where to put Certbot when cloning from Git.
certbot_dir: /opt/certbot
# How to keep Certbot certs up to date.

@ -7,7 +7,11 @@
update: "{{ certbot_keep_updated }}"
force: yes
- name: Set Certbot script variable
set_fact:
certbot_script: "{{ certbot_dir }}/certbot-auto"
- name: Ensure certbot-auto is executable.
file:
path: "{{ certbot_dir }}/certbot-auto"
path: "{{ certbot_script }}"
mode: 0755

@ -0,0 +1,7 @@
---
- name: Install Certbot
package: name=certbot state=present
- name: Set Certbot script variable
set_fact:
certbot_script: certbot

@ -1,5 +1,9 @@
---
- include: install-from-package.yml
when: not certbot_from_git
- include: install-from-git.yml
when: certbot_from_git
- include: renew-cron.yml
when: certbot_auto_renew

@ -1,8 +1,8 @@
---
- name: Add cron job for 'certbot-auto renew' (if configured).
- name: Add cron job for certbot renewal (if configured).
cron:
name: Certbot automatic renewal.
job: "{{ certbot_dir }}/certbot-auto renew --quiet --no-self-upgrade"
job: "{{ certbot_script }} renew --quiet --no-self-upgrade"
minute: "{{ certbot_auto_renew_minute }}"
hour: "{{ certbot_auto_renew_hour }}"
user: "{{ certbot_auto_renew_user }}"

Loading…
Cancel
Save