Friday, August 2, 2019

To get checksum of files and compare in Ansible

---
- hosts: localhost
  tasks:
    - stat:
        path: "./a"
      register: a_stat

    - stat:
        path: "./b"
      register: b_stat

    - debug:
        msg: "Files are same, perform something when they are same"
      when: a_stat.stat.checksum == b_stat.stat.checksum

No comments:

Post a Comment