Check sha1sum of hosts file instead of md5sum

In Ansible 2.5, the stat module moves calculating md5 checksums of files
to the 'checksum_algorithm' option and 'checksum' return value.
To retain compatibility with both current and new versions of Ansible,
use the default checksum algorithm, sha1, instead.

Change-Id: I6e606193f66a4f4c6c70eceee8eeaef05a099f26
This commit is contained in:
Jimmy McCrory 2018-02-16 21:06:16 -08:00
parent 9943de6b76
commit 8f7114732d
2 changed files with 2 additions and 2 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: stat_hosts.stat.checksum | string != update_hosts.stdout | string

View File

@ -53,4 +53,4 @@ host_update "{{ hostvars[item]['ansible_hostname']|default(target_rfc_1034_1035_
{% endfor %}
md5sum /etc/hosts|awk '{print $1}'
sha1sum /etc/hosts|awk '{print $1}'