Skip to content

Commit 93fe36c

Browse files
♻️ refactor certbot installation to use snap instead of apt
Remove old apt-based certbot installation and replace with snap-based installation for better compatibility and updates. Add snapd setup, core snap installation, and proper symlink creation for certbot command availability.
1 parent 17b37e0 commit 93fe36c

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

roles/acme_certificates/tasks/main.yaml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
11
---
2-
- name: Install certbot
2+
- name: Remove OD certbot
33
ansible.builtin.apt:
44
update_cache: true
5+
state: absent
56
pkg:
67
- certbot
7-
- cron
88
- python3-certbot-dns-cloudflare
9+
10+
- name: Install snapd
11+
ansible.builtin.apt:
12+
pkg:
13+
- snapd
14+
15+
- name: Enable and start snapd socket
16+
ansible.builtin.systemd:
17+
name: snapd.socket
18+
enabled: true
19+
state: started
20+
21+
- name: Enable classic snap support (create symlink)
22+
ansible.builtin.file:
23+
src: /var/lib/snapd/snap
24+
dest: /snap
25+
state: link
26+
27+
- name: Install snap core
28+
community.general.snap:
29+
name: core
30+
state: present
31+
32+
- name: Install certbot via snap
33+
community.general.snap:
34+
name: certbot
35+
classic: true
36+
state: present
37+
38+
- name: Create certbot symlink
39+
ansible.builtin.file:
40+
src: /snap/bin/certbot
41+
dest: /usr/bin/certbot
42+
state: link
43+
944
- name: Download acme-dns-hook
1045
ansible.builtin.get_url:
1146
url: >-

0 commit comments

Comments
 (0)