From 58a9f97a9ebf88409ec21b0a730323c4c240861a Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Mon, 22 Jul 2019 13:41:09 +0100 Subject: [PATCH] Restart only installed services Avoids deployment failure while doing the restart of services when rsyslog was not installed. Failure was found while attempting a standalone deployment on a fresh RHEL8 host. Change-Id: I286029011e36dd35411987c7918916f8082d885b --- deployment/time/timezone-baremetal-ansible.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deployment/time/timezone-baremetal-ansible.yaml b/deployment/time/timezone-baremetal-ansible.yaml index 6f941149b6..e40720d581 100644 --- a/deployment/time/timezone-baremetal-ansible.yaml +++ b/deployment/time/timezone-baremetal-ansible.yaml @@ -48,11 +48,15 @@ outputs: timezone: name: "{{ timezone }}" register: timezone_result + - name: Populate service facts + service_facts: - name: Restart services + when: + - timezone_result.changed + - (item + ".service") in ansible_facts.services service: name: "{{ item }}" state: restarted with_items: - rsyslog - crond - when: timezone_result.changed