updated to include more OSs and pip install

This commit is contained in:
Eric Anderson
2020-04-27 13:27:59 -07:00
parent 09c8986636
commit 7203b84e63
15 changed files with 230 additions and 36 deletions
+25
View File
@@ -0,0 +1,25 @@
---
- name: Requirement for Debian 9 support
block:
- name: certbot | Debian | Install the Debian Backports repository
apt_repository:
repo: deb http://ftp.debian.org/debian stretch-backports main
when:
- ansible_distribution == 'Debian'
- ansible_distribution_major_version == '9'
- block:
- name: Install the Ubuntu certbot/certbot PPA Apt Key
apt_key:
keyserver: keyserver.ubuntu.com
id: 7BF576066ADA65728FC7E70A8C47BE8E75BCA694
- name: Install the Ubuntu certbot/certbot PPA
apt_repository:
repo: ppa:certbot/certbot
codename: "{{ ansible_distribution_release }}"
- name: Set the package certbot_python to python3 (ppa uses python3)
set_fact:
certbot_python: python3
when:
- ansible_distribution == 'Ubuntu'
- certbot_use_ppa
+21
View File
@@ -0,0 +1,21 @@
---
# See: https://github.com/geerlingguy/ansible-role-certbot/issues/107
- block:
- name: Ensure dnf-plugins are installed on CentOS 8+.
yum:
name: dnf-plugins-core
state: present
- name: Enable DNF module for CentOS 8+.
shell: |
dnf config-manager --set-enabled PowerTools
args:
warn: false
register: dnf_module_enable
changed_when: false
- name: Set the certbot_python to python3 (Certbot in RHEL 8 uses Python3)
set_fact:
certbot_python: python3
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version | int >= 8
+23 -2
View File
@@ -1,6 +1,27 @@
---
- name: Install Certbot.
package: "name={{ certbot_package }} state=present"
- name: Starting the Certbot Install via {{ certbot_pkg_mgr }}
include_tasks: "{{ certbot_pkg_mgr|lower }}/install.yml"
- block:
- name: Install certbot package
package: name={{ certbot_package }}
register: task_result
until: task_result is success
retries: 10
delay: 2
when:
- certbot_plugins is undefined
- name: Install certbot plugins
apt:
name: "{{ certbot_python }}-certbot-{{ item }}"
register: task_result
until: task_result is success
retries: 10
delay: 2
loop: "{{ certbot_plugins }}"
when: certbot_plugins is defined
when: certbot_pkg_mgr != 'pip'
- name: Set Certbot script variable.
set_fact:
-3
View File
@@ -1,9 +1,6 @@
---
- import_tasks: include-vars.yml
- import_tasks: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
- import_tasks: install-with-package.yml
when: not certbot_install_from_source
+21
View File
@@ -0,0 +1,21 @@
---
- name: certbot | PyPI | Upgrade pip, setuptools, and pyopenssl as required
pip:
name: "{{ item }}"
executable: "{{ certbot_pip_executable }}"
loop:
- pip
- setuptools
- pyopenssl
- name: certbot | PyPI | Install certbot {{ certbot_pip_version }}
pip:
name: certbot=={{ certbot_pip_version }}
executable: "{{ certbot_pip_executable }}"
- name: certbot | PyPI | Install certbot plugins
pip:
name: "certbot-{{ item }}=={{ certbot_pip_version }}"
executable: "{{ certbot_pip_executable }}"
loop: "{{ certbot_plugins }}"
when: certbot_plugins is defined
-20
View File
@@ -1,20 +0,0 @@
---
# See: https://github.com/geerlingguy/ansible-role-certbot/issues/107
- block:
- name: Ensure dnf-plugins are installed on CentOS 8+.
yum:
name: dnf-plugins-core
state: present
- name: Enable DNF module for CentOS 8+.
shell: |
dnf config-manager --set-enabled PowerTools
args:
warn: false
register: dnf_module_enable
changed_when: false
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version | int >= 8
+7
View File
@@ -0,0 +1,7 @@
---
- name: Set the certbot_python to python3 (Certbot in RHEL 7 uses Python3)
set_fact:
certbot_python: python2
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version | int <= 7