From a4aa50585f38041a257198680cfbf4bce8091694 Mon Sep 17 00:00:00 2001 From: t2d Date: Fri, 9 Aug 2024 21:08:35 +0200 Subject: [PATCH 1/3] Restart php-fpm if present --- handlers/main.yml | 8 ++++++++ tasks/preflight.yml | 3 +++ 2 files changed, 11 insertions(+) diff --git a/handlers/main.yml b/handlers/main.yml index 32dda97..2fe09f9 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -18,3 +18,11 @@ name: apache2 state: restarted when: roundcube_apache | bool + notify: + - Restart php-fpm + +- name: Restart php-fpm + ansible.builtin.service: + name: "{{ ansible_facts.services | select('search', '-fpm.service') | first }}" + state: restarted + when: ansible_facts.services is search("-fpm.service") diff --git a/tasks/preflight.yml b/tasks/preflight.yml index f888c82..e53e759 100644 --- a/tasks/preflight.yml +++ b/tasks/preflight.yml @@ -6,3 +6,6 @@ - roundcube_des_key is defined and roundcube_des_key != "" fail_msg: "roundcube_mysql_password and roundcube_des_key must be set" success_msg: "roundcube_mysql_password and roundcube_des_key are set" + +- name: Populate service facts + ansible.builtin.service_facts: From 9b642631291558983899e6dda151b7b012c91471 Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 10 Aug 2024 09:18:24 +0200 Subject: [PATCH 2/3] Refactor to detect apache2 automatically --- defaults/main.yml | 3 --- handlers/main.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6c3f0f8..a40fdf4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -63,6 +63,3 @@ roundcube_carddav_version: 4.4.2 # Installer roundcube_enable_installer: false - -# Apache -roundcube_apache: true diff --git a/handlers/main.yml b/handlers/main.yml index 2fe09f9..49a1827 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -17,7 +17,7 @@ ansible.builtin.service: name: apache2 state: restarted - when: roundcube_apache | bool + when: ansible_facts.services is search("apache2.service") notify: - Restart php-fpm From 1e31117deea480bea48c8dcfaca7adf7fe800f09 Mon Sep 17 00:00:00 2001 From: t2d Date: Wed, 14 Aug 2024 08:49:22 +0200 Subject: [PATCH 3/3] Add generic webserver listener --- handlers/main.yml | 4 ++-- tasks/main.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 49a1827..e6bd939 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -17,12 +17,12 @@ ansible.builtin.service: name: apache2 state: restarted + listen: Restart webserver when: ansible_facts.services is search("apache2.service") - notify: - - Restart php-fpm - name: Restart php-fpm ansible.builtin.service: name: "{{ ansible_facts.services | select('search', '-fpm.service') | first }}" state: restarted + listen: Restart webserver when: ansible_facts.services is search("-fpm.service") diff --git a/tasks/main.yml b/tasks/main.yml index 219a21f..81c6b0b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -88,7 +88,7 @@ follow: False mode: 0777 register: link - notify: Restart apache + notify: Restart webserver - name: Link www to current roundcube release public_html directory ansible.builtin.file: @@ -100,7 +100,7 @@ follow: False mode: 0777 register: link - notify: Restart apache + notify: Restart webserver - name: Ensure roundcube and plugin configs are latest ansible.builtin.template: