From aebb3e4ee1c574bfadfe29a2960461d0e6af1f89 Mon Sep 17 00:00:00 2001 From: Wayne Warren Date: Thu, 23 May 2019 13:32:14 +0000 Subject: [PATCH] Add option to install from pypi --- defaults/main.yml | 2 ++ tasks/install-from-pypi.yml | 25 +++++++++++++++++++++++++ tasks/main.yml | 21 ++++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tasks/install-from-pypi.yml diff --git a/defaults/main.yml b/defaults/main.yml index 3186d8e..ebe1575 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -27,6 +27,8 @@ certbot_create_standalone_stop_services: # - apache # - varnish +certbot_pypi_version: latest + # To install from source (on older OSes or if you need a specific or newer # version of Certbot), set this variable to `yes` and configure other options. certbot_install_from_source: false diff --git a/tasks/install-from-pypi.yml b/tasks/install-from-pypi.yml new file mode 100644 index 0000000..9eb9208 --- /dev/null +++ b/tasks/install-from-pypi.yml @@ -0,0 +1,25 @@ +--- +- name: Install latest Certbot from pypi + when: + - certbot_pypi_version == "latest" + pip: + name: "{{ item }}" + state: latest + with_items: + - certbot + - certbot-nginx + +- name: Install latest Certbot from pypi + when: + - certbot_pypi_version != "latest" + pip: + name: "{{ item }}" + state: present + version: "{{ certbot_pypi_version }}" + with_items: + - certbot + - certbot-nginx + +- name: Set Certbot script variable. + set_fact: + certbot_script: "/usr/local/bin/certbot" diff --git a/tasks/main.yml b/tasks/main.yml index 680aeda..bbd5a9e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,11 +1,26 @@ --- - import_tasks: include-vars.yml + tags: + - certbot - import_tasks: install-with-package.yml - when: not certbot_install_from_source + when: + - not certbot_install_from_source + - not certbot_install_from_pypi + tags: + - certbot - import_tasks: install-from-source.yml when: certbot_install_from_source + tags: + - certbot + +- import_tasks: install-from-pypi.yml + when: + - not certbot_install_from_source + - certbot_install_from_pypi + tags: + - certbot - include_tasks: create-cert-standalone.yml with_items: "{{ certbot_certs }}" @@ -14,6 +29,10 @@ - certbot_create_method == 'standalone' loop_control: loop_var: cert_item + tags: + - certbot - import_tasks: renew-cron.yml when: certbot_auto_renew + tags: + - certbot