diff options
author | 2025-02-23 08:42:25 +0100 | |
---|---|---|
committer | 2025-03-30 17:48:54 +0200 | |
commit | df3e163ce95bfd0e5fd1cc91722d2c9832e1fff2 (patch) | |
tree | ead6e417650b208bee523fbef0c6a8ef47b29d80 | |
parent | Update dependency community.general to v10.5.0 (diff) |
Reload mailserver services on certificate update
-rw-r--r-- | ansible/inventory/hosts.yaml | 3 | ||||
-rw-r--r-- | ansible/roles/certbot/tasks/main.yml | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/ansible/inventory/hosts.yaml b/ansible/inventory/hosts.yaml index 1c4ae82..e499002 100644 --- a/ansible/inventory/hosts.yaml +++ b/ansible/inventory/hosts.yaml @@ -3,6 +3,9 @@ all: lovelace: ansible_host: lovelace.box.pydis.wtf wireguard_subnet: 10.2.0.0/16 + certbot_reload_services: + - dovecot + - postfix@- ldap01: ansible_host: ldap01.box.pydis.wtf wireguard_subnet: 10.3.0.0/16 diff --git a/ansible/roles/certbot/tasks/main.yml b/ansible/roles/certbot/tasks/main.yml index c6df7a1..e6691a1 100644 --- a/ansible/roles/certbot/tasks/main.yml +++ b/ansible/roles/certbot/tasks/main.yml @@ -76,14 +76,24 @@ - role::certbot -- name: Reload nginx after certificate renewal +# BEGIN temporary cleanup task +- name: Remove old hook file + ansible.builtin.file: + path: /etc/letsencrypt/renewal-hooks/deploy/reload-nginx + state: absent +# END temporary cleanup task + +- name: Reload services after certificate renewal ansible.builtin.copy: content: | #!/bin/sh set -ex systemctl reload nginx - dest: /etc/letsencrypt/renewal-hooks/deploy/reload-nginx + {% if certbot_reload_services %} + systemctl reload {{ certbot_reload_services | join(" ") }} + {% endif %} + dest: /etc/letsencrypt/renewal-hooks/deploy/reload-services owner: root group: root mode: "0500" |