It may be helpful to see the rest of your play, however, I ran into an issue 
like this once.

It turned out that the file I was templating was also in my git repo.  My git 
task, was using force=yes to revert any local changes.  This would cause git to 
overwrite my settings file on every run, and then the template task would 
repopulate.

Just a thought of something to look into.
-- 
Matt Martz
m...@sivel.net

On December 30, 2013 at 7:47:05 AM, Christian Jensen 
(christ...@officepools.com) wrote:

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

--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to