From 10e2cc82b30bd112691a4b549bc95b61ad73e593 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 23 Jul 2021 16:02:12 +0200 Subject: [PATCH] Restart the service after a change in the systemd unit. --- tasks/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index eeb93a5..ff22ee0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -84,6 +84,12 @@ with_items: '{{ springboot_apps }}' when: ansible_service_mgr == 'systemd' notify: systemd reload + register: springboot_app_restart + + - name: Restart the springboot apps if the systemd unit changed + service: name={{ item.name }} state=restarted + with_items: '{{ springboot_apps }}' + when: springboot_app_restart is changed - name: Force all notified handlers to run at this point, not waiting for normal sync points meta: flush_handlers