module copy with content reports changes on every run

72 views
Skip to first unread message

Christian Loos

unread,
Jan 23, 2015, 6:00:41 AM1/23/15
to ansible...@googlegroups.com
Hi,

if i run a task with this:
copy: dest=/etc/timezone content="Europe/Berlin" owner=root group=root mode=0644
it reports on every run changes.

Verbose output of two runs:
changed: [xxx] => {"changed": true, "checksum": "d34f419876c03cf85365d9102477a4f5791451ae", "dest": "/etc/timezone", "gid": 0, "group": "root", "md5sum": "f047a3577fcd6af23b47814293e293c0", "mode": "0644", "owner": "root", "size": 13, "src": "/home/xxx/.ansible/tmp/ansible-tmp-1422009942.63-92526854461725/source", "state": "file", "uid": 0}

changed: [xxx] => {"changed": true, "checksum": "d34f419876c03cf85365d9102477a4f5791451ae", "dest": "/etc/timezone", "gid": 0, "group": "root", "md5sum": "f047a3577fcd6af23b47814293e293c0", "mode": "0644", "owner": "root", "size": 13, "src": "/home/xxx/.ansible/tmp/ansible-tmp-1422009987.9-92475302492184/source", "state": "file", "uid": 0}

The md5sum of the transfered content always doesn't match the file content.

Control host: Ubuntu
Destination Host: Debian
ansible 1.8.2


Chris

Matt Martz

unread,
Jan 23, 2015, 8:34:53 AM1/23/15
to ansible...@googlegroups.com
Your problem is in the way you are using the content argument.  Your string does not include a trailing newline, and when you run dpkg-reconfigure to update the timezone, dpkg-reconfigure will notice that there is no trailing newline and "fix it".  So every time your task runs, you are removing the trailing newline that dpkg-reconfigure adds to that file.

There is some discussion about this at https://github.com/ansible/ansible/issues/5715

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0a91389c-399d-4ee7-80d4-ca255143881c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages