# Why fetch yielded md5 mismatch message?

**URL:** <https://forum.ansible.com/t/why-fetch-yielded-md5-mismatch-message/11603>\
**Category:** Ansible Project\
**Created:** [June 7, 2012, 4:27am UTC](https://forum.ansible.com/t/why-fetch-yielded-md5-mismatch-message/11603 "2012-06-07T04:27:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zack\_Perry](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@Zack\_Perry](https://forum.ansible.com/u/Zack_Perry)\
**Post date:** [June 7, 2012, 4:27am UTC](https://forum.ansible.com/t/why-fetch-yielded-md5-mismatch-message/11603/1 "2012-06-07T04:27:26Z")

</div>

I am new to Ansible - still going over the wiki and practicing using 5  
KVM guests running SL6.2. Ansible 5.0 cloned from github is used.

While reviewing [http://ansible.github.com/modules.html](http://ansible.github.com/modules.html) and practicing  
the fetch module, I did:

[root@sl0 ~]# mkdir logtree  
[root@sl0 ~]# ansible all -m fetch -a "src=/var/log/messages dest=/  
root/logtree"  
sl4 | FAILED \>\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"md5sum": "a62b77d7291707bf19fdd40e43fae390",  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "md5 mismatch"  
}

sl3 | FAILED \>\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"md5sum": "54c9f21817602192176b086db61bdb73",  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "md5 mismatch"  
}

sl1 | FAILED \>\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"md5sum": "59a9739eb255d06705b2ea401ca8cc20",  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "md5 mismatch"  
}

sl2 | FAILED \>\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"md5sum": "e4d639a1f2853d3799a9af9c026d9dcd",  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "md5 mismatch"  
}

Note all these FAILED and 'md5 mismatch' messages. What did I do  
wrong? I did get the following:

[root@sl0 ~]# ls -lR logtree  
logtree:  
total 16  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl1  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl2  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl3  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 sl4

logtree/sl1:  
total 4  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl1/var:  
total 4  
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl1/var/log:  
total 52  
-rw-r--r-- 1 root root 50065 Jun 6 21:17 messages

logtree/sl2:  
total 4  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl2/var:  
total 4  
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl2/var/log:  
total 52  
-rw-r--r-- 1 root root 50063 Jun 6 21:17 messages

logtree/sl3:  
total 4  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl3/var:  
total 4  
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl3/var/log:  
total 52  
-rw-r--r-- 1 root root 49954 Jun 6 21:17 messages

logtree/sl4:  
total 4  
drwxr-xr-x 3 root root 4096 Jun 6 21:17 var

logtree/sl4/var:  
total 4  
drwxr-xr-x 2 root root 4096 Jun 6 21:17 log

logtree/sl4/var/log:  
total 52  
-rw-r--r-- 1 root root 50065 Jun 6 21:17 messages

Regards,

Zack

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [June 8, 2012, 2:06am UTC](https://forum.ansible.com/t/why-fetch-yielded-md5-mismatch-message/11603/2 "2012-06-08T02:06:59Z")

</div>

Don’t know, find the code that says “md5 mismatch”, add some debug, and see what two things it is comparing.

Running from OS X perhaps? Then it’s a known issue.

---

<div class="post-metadata">

**Author:** ![Zack\_Perry](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@Zack\_Perry](https://forum.ansible.com/u/Zack_Perry)\
**Post date:** [June 8, 2012, 3:52pm UTC](https://forum.ansible.com/t/why-fetch-yielded-md5-mismatch-message/11603/3 "2012-06-08T15:52:20Z")

</div>

Hi Michael,

Thanks for the tip. No, I didn't use a Mac. As I stated, all KVM  
guests sl[0-4] run Scientific Linux 6.2, including the ansible control  
host sl0. I also doubled checked:

[root@sl0 ~]# which md5sum  
/usr/bin/md5sum  
[root@sl0 ~]# ssh root@sl1  
Enter passphrase for key '/root/.ssh/id\_rsa':  
Last login: Wed Jun 6 22:55:21 2012 from sl0  
[root@sl1 ~]# which md5sum  
/usr/bin/md5sum

But you were right, in /usr/lib/python2.6/site-packages/ansible/runner/  
\_\_init\_\_.py, I did see the following:

&nbsp;&nbsp;&nbsp;476 # compare old and new md5 for support of change hooks  
&nbsp;&nbsp;&nbsp;477 local\_md5 = None  
&nbsp;&nbsp;&nbsp;478 if os.path.exists(dest):  
&nbsp;&nbsp;&nbsp;479 local\_md5 = os.popen("md5sum %s" %  
dest).read().split()[0]  
&nbsp;&nbsp;&nbsp;480 remote\_md5 = self.\_low\_level\_exec\_command(conn,  
"md5sum %s" % source, tmp, True)[0].split()[0]  
&nbsp;&nbsp;&nbsp;481  
&nbsp;&nbsp;&nbsp;482 if remote\_md5 != local\_md5:  
&nbsp;&nbsp;&nbsp;483 # create the containing directories, if needed  
&nbsp;&nbsp;&nbsp;484 os.makedirs(os.path.dirname(dest))  
&nbsp;&nbsp;&nbsp;485  
&nbsp;&nbsp;&nbsp;486 # fetch the file and check for changes  
&nbsp;&nbsp;&nbsp;487 conn.fetch\_file(source, dest)  
&nbsp;&nbsp;&nbsp;488 new\_md5 = os.popen("md5sum %s" %  
dest).read().split()[0]  
&nbsp;&nbsp;&nbsp;489 if new\_md5 != remote\_md5:  
&nbsp;&nbsp;&nbsp;490 result = dict(failed=True, msg="md5 mismatch",  
md5sum=new\_md5)  
&nbsp;&nbsp;&nbsp;491 return ReturnData(host=conn.host,  
result=result)  
&nbsp;&nbsp;&nbsp;492 result = dict(changed=True, md5sum=new\_md5)  
&nbsp;&nbsp;&nbsp;493 return ReturnData(host=conn.host, result=result)

Late this afternoon, I anticipate to have a bit of quiet time. I will  
do what you suggested and "fix" it.

Regards,

Zack

---

<div class="post-metadata">

**Author:** ![Zack\_Perry](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@Zack\_Perry](https://forum.ansible.com/u/Zack_Perry)\
**Post date:** [June 11, 2012, 5:06am UTC](https://forum.ansible.com/t/why-fetch-yielded-md5-mismatch-message/11603/4 "2012-06-11T05:06:06Z")

</div>

Hi Michael,

I ran /usr/bin/ansible under pdb in GNU Emacs. After setting three  
break points, and used -f 1 to avoid the use of the Python  
multiprocessing module (the default self.focks is set to 5), so that  
the function \_execute\_fetch(self, conn, tmp): gets called directly. I  
was able to pin-point the bug in line 480 in my previous post.

Nevertheless, when I went to github to prepare to submit a patch, it  
had already been taken care of and Michael had merged it into the  
master. So, I simply cloned again and now fetch works fine.

Thank you and Best Regards,

Zack
