From 664d581eb277c4be8d257906b6455bcba7860093 Mon Sep 17 00:00:00 2001 From: Matthew Fennell Date: Sun, 7 Jan 2024 13:41:50 +0000 Subject: Only reload prosody if its configuration changes There is no sense reloading prosody if none of its configuration files have changed. Therefore, this commit moves the reload to a handler that only gets triggered in this situation. --- playbook.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/playbook.yaml b/playbook.yaml index 3da1246..da17227 100644 --- a/playbook.yaml +++ b/playbook.yaml @@ -34,6 +34,7 @@ group: root mode: "0640" become: true + notify: Reload prosody - name: Ensure host-specific prosody configuration is available ansible.builtin.template: src: "{{ playbook_dir }}/files/virtual_host.cfg.lua.j2" @@ -42,6 +43,7 @@ group: root mode: "0644" become: true + notify: Reload prosody - name: Ensure host-specific prosody configuration is set ansible.builtin.file: src: "/etc/prosody/conf.avail/{{ virtual_host }}.cfg.lua" @@ -50,9 +52,16 @@ group: root state: link become: true - - name: Ensure prosody config is reloaded + notify: Reload prosody + - name: Ensure prosody is enabled ansible.builtin.service: name: prosody enabled: true + become: true + + handlers: + - name: Reload prosody + ansible.builtin.service: + name: prosody state: reloaded become: true -- cgit v1.2.3