# Copy: ability to let the action fail if remote file is modified?

**URL:** <https://forum.ansible.com/t/copy-ability-to-let-the-action-fail-if-remote-file-is-modified/13638>\
**Category:** Ansible Project\
**Created:** [October 9, 2013, 9:38am UTC](https://forum.ansible.com/t/copy-ability-to-let-the-action-fail-if-remote-file-is-modified/13638 "2013-10-09T09:38:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fredrik\_Jonson](https://avatars.discourse-cdn.com/v4/letter/f/4af34b/32.png) [@Fredrik\_Jonson](https://forum.ansible.com/u/Fredrik_Jonson)\
**Post date:** [October 9, 2013, 9:38am UTC](https://forum.ansible.com/t/copy-ability-to-let-the-action-fail-if-remote-file-is-modified/13638/1 "2013-10-09T09:38:18Z")

</div>

Hi all,

I'm concerned that I'll deploy configuration files with the copy action, and  
later on manually edit the files on the server[0] and forget about copying  
the changes to the source file in mercurial. Next time I run my ansible  
playbook those changes will silently be overwritten.

I know about the backup option. While it saves me from data loss, it is silent,  
and wont fail the playbook execution.

So, what I'd like is a way to have the copy action fail when the remote file  
(dst) exists but differ from the local file (src). Is that possible?

[0] Old habits die hard.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 9, 2013, 2:18pm UTC](https://forum.ansible.com/t/copy-ability-to-let-the-action-fail-if-remote-file-is-modified/13638/2 "2013-10-09T14:18:21Z")

</div>

Set force=no and the copy module will not replace existing files.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [October 9, 2013, 3:17pm UTC](https://forum.ansible.com/t/copy-ability-to-let-the-action-fail-if-remote-file-is-modified/13638/3 "2013-10-09T15:17:24Z")

</div>

also using --check --diff shows you the differences in a dry run for copy, very useful to see if there are any unexpected changes.
