I am having a small problem.
I am running Vagrant and am writing out a small configuration file using a template.
Each time I run it, the result shows changed.
I looked at the source to see what might get me to that point and all I could see is that the md5 might be different… except each time I run it, the md5 of the resultant file is identical.
Here is what is getting reported:
changed: [192.168.111.101] =>{
“changed”:true,
“dest”:“/opt/sweird/repo/src/sweird/local_settings.py”,
“gid”:1003,
“group”:“sweird”,
“item”:“”,
“md5sum”:“cf5991322069bae4258b4cb6fa8c5869”,
“mode”:“0644”,
“owner”:“sweird”,
“size”:2538,
“src”:“/home/vagrant/.ansible/tmp/ansible-1388360109.45-120659720431969/source”,
“state”:“file”,
“uid”:1001
}
And then if I go into the destination and run:
root@appserver1:/home/vagrant# md5sum /opt/sweird/repo/src/sweird/local_settings.py
cf5991322069bae4258b4cb6fa8c5869 /opt/sweird/repo/src/sweird/local_settings.py
root@appserver1:/home/vagrant#
What I am seeing here is that there is a message with the file name included in the output of the command.
This is consistent with the executed line (where it does a bunch of ORing):
EXEC COMMAND /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=xwsjfftauthtycoxcqzhvizeizmuzhad] password: " -u root /bin/sh -c '”’“‘echo SUDO-SUCCESS-xwsjfftauthtycoxcqzhvizeizmuzhad; rc=0; [ -r “/opt/sweird/repo/src/sweird/local_settings.py” ] || rc=2; [ -f “/opt/sweird/repo/src/sweird/local_settings.py” ] || rc=1; [ -d “/opt/sweird/repo/src/sweird/local_settings.py” ] && rc=3; (/usr/bin/md5sum /opt/sweird/repo/src/sweird/local_settings.py 2>/dev/null) || (/sbin/md5sum -q /opt/sweird/repo/src/sweird/local_settings.py 2>/dev/null) || (/usr/bin/digest -a md5 /opt/sweird/repo/src/sweird/local_settings.py 2>/dev/null) || (/sbin/md5 -q /opt/sweird/repo/src/sweird/local_settings.py 2>/dev/null) || (/usr/bin/md5 -n /opt/sweird/repo/src/sweird/local_settings.py 2>/dev/null) || (/bin/md5 -q /opt/sweird/repo/src/sweird/local_settings.py 2>/dev/null) || (/usr/bin/csum -h MD5 /opt/sweird/repo/src/sweird/local_settings.py 2>/dev/null) || (echo “${rc} /opt/sweird/repo/src/sweird/local_settings.py”)’”‘"’’
Since the line in the code appears to only be wanting to grab the md5 of the resultant string and comparing it with what might be the md5 with the filename appended to it, there is a 100% chance that this will report changed 100% of the time.
I looked at the options for md5sum and tried a few things but always got the filename reported back.
Does this function need to look for the first space and hack off anything after it?
Thanks,
Christian
P.S. this is getting run against precise64 straight from vagrantup