Skip to content

Commit df3e163

Browse files
committed
Reload mailserver services on certificate update
1 parent 43490b2 commit df3e163

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ansible/inventory/hosts.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ all:
33
lovelace:
44
ansible_host: lovelace.box.pydis.wtf
55
wireguard_subnet: 10.2.0.0/16
6+
certbot_reload_services:
7+
- dovecot
8+
- postfix@-
69
ldap01:
710
ansible_host: ldap01.box.pydis.wtf
811
wireguard_subnet: 10.3.0.0/16

ansible/roles/certbot/tasks/main.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,24 @@
7676
- role::certbot
7777

7878

79-
- name: Reload nginx after certificate renewal
79+
# BEGIN temporary cleanup task
80+
- name: Remove old hook file
81+
ansible.builtin.file:
82+
path: /etc/letsencrypt/renewal-hooks/deploy/reload-nginx
83+
state: absent
84+
# END temporary cleanup task
85+
86+
- name: Reload services after certificate renewal
8087
ansible.builtin.copy:
8188
content: |
8289
#!/bin/sh
8390
set -ex
8491
8592
systemctl reload nginx
86-
dest: /etc/letsencrypt/renewal-hooks/deploy/reload-nginx
93+
{% if certbot_reload_services %}
94+
systemctl reload {{ certbot_reload_services | join(" ") }}
95+
{% endif %}
96+
dest: /etc/letsencrypt/renewal-hooks/deploy/reload-services
8797
owner: root
8898
group: root
8999
mode: "0500"

0 commit comments

Comments
 (0)