allow installation using pip

This commit is contained in:
Raphaël Droz 2018-03-21 19:22:24 -03:00
parent a49d4e63a1
commit 823fa52f31
5 changed files with 38 additions and 7 deletions

View File

@ -7,6 +7,7 @@ Installs and configures Certbot (for Let's Encrypt).
## Requirements ## Requirements
If installing from source, Git is required. You can install Git using the `geerlingguy.git` role. If installing from source, Git is required. You can install Git using the `geerlingguy.git` role.
If installing from pip, pip is required.
Generally, installing from source (see section `Source Installation from Git`) leads to a better experience using Certbot and Let's Encrypt, especially if you're using an older OS release. Generally, installing from source (see section `Source Installation from Git`) leads to a better experience using Certbot and Let's Encrypt, especially if you're using an older OS release.
@ -60,11 +61,18 @@ Services that should be stopped while `certbot` runs it's own standalone server
These services will only be stopped the first time a new cert is generated. These services will only be stopped the first time a new cert is generated.
### Installation from pip (or pip3)
certbot_install: 'pip'
# or certbot_install: 'pip3'
The resulting certbot program will live in /usr/local/bin/certbot
### Source Installation from Git ### Source Installation from Git
You can install Certbot from it's Git source repository if desired. This might be useful in several cases, but especially when older distributions don't have Certbot packages available (e.g. CentOS < 7, Ubuntu < 16.10 and Debian < 8). You can install Certbot from it's Git source repository if desired. This might be useful in several cases, but especially when older distributions don't have Certbot packages available (e.g. CentOS < 7, Ubuntu < 16.10 and Debian < 8).
certbot_install_from_source: false certbot_install: "source"
certbot_repo: https://github.com/certbot/certbot.git certbot_repo: https://github.com/certbot/certbot.git
certbot_version: master certbot_version: master
certbot_keep_updated: true certbot_keep_updated: true

View File

@ -27,9 +27,14 @@ certbot_create_standalone_stop_services:
# - apache # - apache
# - varnish # - varnish
# To install from source (on older OSes or if you need a specific or newer # Possible choices include:
# version of Certbot), set this variable to `yes` and configure other options. # - "source" (on older OSes or if you need a specific or newer version of Certbot)
certbot_install_from_source: false # - "pkg" (for distribution package)
# - "pip" (or "pip3")
# - False (to omit installation)
certbot_install: "pkg"
# Next 4 options only apply to certbot_install: "source"
certbot_repo: https://github.com/certbot/certbot.git certbot_repo: https://github.com/certbot/certbot.git
certbot_version: master certbot_version: master
certbot_keep_updated: true certbot_keep_updated: true

View File

@ -4,7 +4,7 @@
become: true become: true
vars: vars:
certbot_install_from_source: true certbot_install: "source"
certbot_auto_renew_user: root certbot_auto_renew_user: root
pre_tasks: pre_tasks:

View File

@ -0,0 +1,15 @@
---
- name: Install pip
package: name=python-pip state=present
when: certbot_install == 'pip'
- name: Install pip3
package: name=python3-pip state=present
when: certbot_install == 'pip3'
- name: Install Certbot.
pip: name="{{ certbot_package }}" state=present executable="{{ certbot_install }}"
- name: Set Certbot script variable.
set_fact:
certbot_script: /usr/local/bin/certbot

View File

@ -2,10 +2,13 @@
- import_tasks: include-vars.yml - import_tasks: include-vars.yml
- import_tasks: install-with-package.yml - import_tasks: install-with-package.yml
when: not certbot_install_from_source when: certbot_install == 'pkg' and not certbot_install_from_source | default(False)
- import_tasks: install-from-source.yml - import_tasks: install-from-source.yml
when: certbot_install_from_source when: certbot_install == 'source' or certbot_install_from_source | default(False)
- import_tasks: install-with-pip.yml
when: certbot_install in ['pip', 'pip3']
- include_tasks: create-cert-standalone.yml - include_tasks: create-cert-standalone.yml
with_items: "{{ certbot_certs }}" with_items: "{{ certbot_certs }}"