From c5fcd32d273867b87258e0fc7a377e9a17f93095 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de>
Date: Mon, 2 Dec 2024 11:15:16 +0100
Subject: [PATCH] refactor: restart Apache by flushing handlers instead of
 registering a variable and checking for changed status

---
 tasks/configure_apache.yml | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tasks/configure_apache.yml b/tasks/configure_apache.yml
index 5a2a07d..946239d 100644
--- a/tasks/configure_apache.yml
+++ b/tasks/configure_apache.yml
@@ -7,12 +7,9 @@
   loop:
     - "cgid"
     - "ssl"
-  register: a2enmod
-- name: restart apache immediately to make sure mod_ssl is running before configuring TLS. Just notifying the handler doesn't suffice.
-  ansible.builtin.systemd:
-    unit: "apache2"
-    state: restarted
-  when: a2enmod.changed    # noqa no-handler
+  notify: restart apache
+- name: Restart apache immediately to make sure mod_ssl is running before configuring TLS.
+  ansible.builtin.meta: flush_handlers
 
 - name: Apache-Konfigurationsdateien einspielen (copied)
   ansible.builtin.copy:
-- 
GitLab