Hi@akhtar,
You can use the copy module in Ansible. You can use check_mode: yes and diff: yes tasks options to show differences as shown below.
- hosts: localhost
gather_facts: no
tasks:
- name: "Show the difference between files"
copy:
src: file1.txt
dest: file2.txt
check_mode: yes
diff: yes