Fix error when /etc/hosts does not exist

Even though this might seem very rare/unusual/non-acceptable
there are cases where the /etc/hosts file does not exist
(or has been moved temporarily). This fix prevents error
from being raised. This furthermore ensure idem-potency
as without the fix, using the role after failure just
works because /etc/hosts has now been created.

Change-Id: Ied4875d4fc6754bb262496e69b231b192166b23c
(cherry picked from commit d5d516ee7c)
This commit is contained in:
Olivier Bourdon 2018-03-15 16:14:16 +01:00
parent 6b4a115ab0
commit e98b5bb0c7
1 changed files with 1 additions and 1 deletions

View File

@ -37,4 +37,4 @@
- name: Update hosts file
command: "/usr/local/bin/openstack-host-hostfile-setup.sh"
register: update_hosts
changed_when: stat_hosts.stat.md5 | string != update_hosts.stdout | string
changed_when: not stat_hosts.stat.exists or stat_hosts.stat.md5 | string != update_hosts.stdout | string