Skip to content

Commit

Permalink
Install Certbot via snap
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba committed Apr 10, 2020
1 parent 6214534 commit 2464178
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 28 deletions.
4 changes: 1 addition & 3 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ platforms:
groups:
- targets
- name: pebble
# Until Certbot >= 0.34.0 is used, Pebble needs an older version
# https://github.com/letsencrypt/pebble/issues/192
image: letsencrypt/pebble:v1.0.1
image: letsencrypt/pebble:latest
pre_build_image: true
override_command: false
env:
Expand Down
31 changes: 6 additions & 25 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,13 @@
become: true
become_user: root

- name: Add Certbot PPA key
apt_key:
id: "{{ nginx_certbot_ubuntu_apt_key }}"
# https://unix.stackexchange.com/a/110594
keyserver: "hkps://keyserver.ubuntu.com:443"
become: true
become_user: root

- name: Add Certbot PPA
apt_repository:
repo: >-
deb
http://ppa.launchpad.net/certbot/certbot/ubuntu
{{ ansible_distribution_release }}
main
update_cache: true
become: true
become_user: root
- import_tasks: migrate.yml

- name: Install Certbot package
apt:
# This is Python 3, but named differently in the PPA
name: python-certbot-nginx
force_apt_get: true
become: true
become_user: root
- name: Install Certbot snap package
snap:
name: certbot
classic: true
channel: edge

# Nginx must be already started via systemd, or running Certbot will start its
# own instance, then orphan that Nginx process (still bound to ports) when it
Expand Down
34 changes: 34 additions & 0 deletions tasks/migrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: Remove obsolete Certbot PPA key
apt_key:
id: "{{ nginx_certbot_ubuntu_apt_key }}"
# https://unix.stackexchange.com/a/110594
keyserver: "hkps://keyserver.ubuntu.com:443"
state: absent
become: true
become_user: root

- name: Remove obsolete Certbot PPA
apt_repository:
repo: >-
deb
http://ppa.launchpad.net/certbot/certbot/ubuntu
{{ ansible_distribution_release }}
main
update_cache: true
state: absent
become: true
become_user: root

- name: Remove obsolete Certbot packages
apt:
name:
# This is Python 3, but named differently in the PPA
- python-certbot-nginx
- python3-certbot-nginx
- certbot
- python3-certbot
force_apt_get: true
state: absent
become: true
become_user: root

0 comments on commit 2464178

Please sign in to comment.