Skip to content

Commit

Permalink
Merge pull request #27 from coopdevs/feature/ubuntu_focal
Browse files Browse the repository at this point in the history
Ubuntu 20.04 support
  • Loading branch information
cesarlr authored Jun 8, 2020
2 parents d3566b6 + a90918e commit 80e7ad5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 0 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
---
letsencrypt_staging: false
certbot_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1
certbot_nginx_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ galaxy_info:
versions:
- xenial
- bionic
- focal

galaxy_tags:
- certbot
Expand Down
3 changes: 2 additions & 1 deletion tasks/certificate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
--cert-name '{{ certbot_nginx_cert_name }}'
{% endif %}
{% if letsencrypt_staging %} --staging {% endif %}
when: letsencrypt_cert.stat.exists and certbot_force_update is defined
{% if ansible_distribution_version >= "20.04" %} --non-interactive {% endif %}
when: letsencrypt_cert.stat.exists and certbot_force_update | bool
notify: reload nginx
17 changes: 16 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
---
- name: Set Certbot package name and versions (Ubuntu >= 20.04)
set_fact:
certbot_version: 0.40.0-1
certbot_nginx_version: 0.40.0-0ubuntu0.1
certbot_nginx_name: python3-certbot-nginx
when: ansible_distribution_version >= "20.04"

- name: Set Certbot package name and versions (Ubuntu < 20.04)
set_fact:
certbot_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1
certbot_nginx_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1
certbot_nginx_name: python-certbot-nginx
when: ansible_distribution_version < "20.04"

- name: Add certbot repository
apt_repository:
repo: 'ppa:certbot/certbot'
state: present
when: ansible_distribution_version < "20.04"

- name: Install certbot
package:
Expand All @@ -11,7 +26,7 @@

- name: Install certbot-nginx plugin
package:
name: "python-certbot-nginx={{ certbot_nginx_version }}"
name: "{{ certbot_nginx_name }}={{ certbot_nginx_version }}"
state: present

- import_tasks: certificate.yml
Expand Down

0 comments on commit 80e7ad5

Please sign in to comment.