Compare files on client and server machine

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.

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.