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
This commit is contained in:
Sorin Sbarnea 2019-07-22 13:41:09 +01:00
parent 3d0b499bae
commit 58a9f97a9e
1 changed files with 5 additions and 1 deletions

View File

@ -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