# copy module ignores --check flag for file params when md5sums are the same -- Not Cool!

**URL:** <https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714>\
**Category:** Ansible Project\
**Created:** [November 6, 2014, 9:46pm UTC](https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714 "2014-11-06T21:46:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_McGowan](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sean\_McGowan](https://forum.ansible.com/u/Sean_McGowan)\
**Post date:** [November 6, 2014, 9:46pm UTC](https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714/1 "2014-11-06T21:46:13Z")

</div>

I am using ansible 1.7.2 on RedHat

Note that I am super happy that I was doing something somewhat innocuous; however, this did just make a large number of changes across 600+ hosts… not a very cool behavior… this did not exist in 1.5, which is the version from which i upgraded.

thanks in advance…

relevant play:

# roles/common/tasks/main.yml

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 7, 2014, 2:25pm UTC](https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714/2 "2014-11-07T14:25:39Z")

</div>

Can you please be explicit about what the “not a very cool behavior” is ?

I’m having trouble parsing your intent from the above.

Thanks!

---

<div class="post-metadata">

**Author:** ![Sean\_McGowan](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sean\_McGowan](https://forum.ansible.com/u/Sean_McGowan)\
**Post date:** [November 7, 2014, 2:43pm UTC](https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714/3 "2014-11-07T14:43:45Z")

</div>

> Can you please be explicit about what the “not a very cool behavior” is ?

no problem. what the example below shows is that when using the copy module with file parameters (e.g. mode, owner, group) that the --check flag works if and only if the src and dest checksums do not match. When they are equal, ansible happily makes the file parameter changes, regardless of --check usage. I updated to 1.7.2 from 1.5 and this behavior did not exist before. In 1.5, if the files were the same and the mode was different (for example), ansible would flag it as changed, but not make the change when using the --check flag. This, in my opinion, is the correct and expected behavior.

Thanks!

---

<div class="post-metadata">

**Author:** ![Sean\_McGowan](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sean\_McGowan](https://forum.ansible.com/u/Sean_McGowan)\
**Post date:** [November 11, 2014, 8:27pm UTC](https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714/4 "2014-11-11T20:27:33Z")

</div>

following up on this… is this a bug or an expected behaviour?

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [November 12, 2014, 3:41pm UTC](https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714/5 "2014-11-12T15:41:06Z")

</div>

It is a bug. However, I think there have been several fixes to the  
file/copy module regarding check mode recently. For instance:  
[https://github.com/ansible/ansible/issues/8639](https://github.com/ansible/ansible/issues/8639)

I've just tested a very simple copy module playbook and it incorrectly  
changed the mode with ansible-1.7.2 but did not set the mode with the  
code in the ansible devel branch. So I believe this has been fixed.  
If you want to confirm with your more complex case you could check out  
the repository from [https://github.com/ansible/ansible](https://github.com/ansible/ansible) and give it a  
try.

-Toshio

---

<div class="post-metadata">

**Author:** ![Sean\_McGowan](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sean\_McGowan](https://forum.ansible.com/u/Sean_McGowan)\
**Post date:** [November 12, 2014, 11:07pm UTC](https://forum.ansible.com/t/copy-module-ignores-check-flag-for-file-params-when-md5sums-are-the-same-not-cool/16714/6 "2014-11-12T23:07:51Z")

</div>

i am unable to pull the development branch at work. if i have a chance i will pull it down and test it at home. it is my hope to get involved with this project because i think it is awesome; however, there are still a few hurdles (e.g. no real spare time right now 🙂 ).

anyhow… let me know if you want me to put it up as a bug in github. if not, then i will just set a reminder to look at this sometime in the future.

thanks!
