Skip to content

Commit c03ec68

Browse files
committed
Ubuntu 20.04 support
1 parent d3566b6 commit c03ec68

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

defaults/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
---
22
letsencrypt_staging: false
3-
certbot_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1
4-
certbot_nginx_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1

meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ galaxy_info:
1313
versions:
1414
- xenial
1515
- bionic
16+
- focal
1617

1718
galaxy_tags:
1819
- certbot

tasks/certificate.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
--cert-name '{{ certbot_nginx_cert_name }}'
2323
{% endif %}
2424
{% if letsencrypt_staging %} --staging {% endif %}
25-
when: letsencrypt_cert.stat.exists and certbot_force_update is defined
25+
{% if ansible_distribution_version >= "20.04" %} --non-interactive {% endif %}
26+
when: letsencrypt_cert.stat.exists and certbot_force_update == true
2627
notify: reload nginx

tasks/main.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
---
2+
3+
- name: Set Certbot package name and versions (Ubuntu >= 20.04)
4+
set_fact:
5+
certbot_version: 0.40.0-1
6+
certbot_nginx_version: 0.40.0-0ubuntu0.1
7+
certbot_nginx_name: python3-certbot-nginx
8+
when: ansible_distribution_version >= "20.04"
9+
10+
- name: Set Certbot package name and versions (Ubuntu < 20.04)
11+
set_fact:
12+
certbot_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1
13+
certbot_nginx_version: 0.31.0-1+ubuntu{{ ansible_distribution_version }}.1+certbot+1
14+
certbot_nginx_name: python-certbot-nginx
15+
when: ansible_distribution_version < "20.04"
16+
217
- name: Add certbot repository
318
apt_repository:
419
repo: 'ppa:certbot/certbot'
520
state: present
21+
when: ansible_distribution_version < "20.04"
622

723
- name: Install certbot
824
package:
@@ -11,7 +27,7 @@
1127

1228
- name: Install certbot-nginx plugin
1329
package:
14-
name: "python-certbot-nginx={{ certbot_nginx_version }}"
30+
name: "{{ certbot_nginx_name }}={{ certbot_nginx_version }}"
1531
state: present
1632

1733
- import_tasks: certificate.yml

0 commit comments

Comments
 (0)