# Compare files on client and server machine

**URL:** <https://forum.ansible.com/t/compare-files-on-client-and-server-machine/12971>\
**Category:** Ansible Project\
**Created:** [June 17, 2013, 2:24am UTC](https://forum.ansible.com/t/compare-files-on-client-and-server-machine/12971 "2013-06-17T02:24:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [June 17, 2013, 2:24am UTC](https://forum.ansible.com/t/compare-files-on-client-and-server-machine/12971/1 "2013-06-17T02:24:36Z")

</div>

Hi,

I am new to ansible and hope that my post can be approved soon.

I wish to ask if ansible is capable of comparing files between client and server machine.  
I did the action statement below but it compares between 2 files on server machine instead of 1 file on client and the other on server machine.

tasks:

- name: Compare between 2 files  
action: shell diff /home/celine/Desktop/file1 /home/celine/Desktop/file2

What should be the correct action statement?

Thank you.

---

<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:** [June 17, 2013, 3:47am UTC](https://forum.ansible.com/t/compare-files-on-client-and-server-machine/12971/2 "2013-06-17T03:47:34Z")

</div>

Ansible has a --diff flag that will show how template files change, which can be used in --check mode to test for potential changes without applying change.

This seems like what you want and does not require playbook modification.
