I'm trying to do this playbook for half a day. I'm using stat module to check sha1sum of file and if it is not equal to second file it should replace correct file. But while registering some variables the output says that variables is undefined What am I doing wrong ?
--- - hosts: all remote_user: root tasks: - name: get sum of file stat: path: /home/roundcube/config.php checksum_algorithm: sha1 get_checksum: yes register: sum stat: path: /home/archive/config.php checksum_algorithm: sha1 get_checksum: yes register: sum2 - name: result ansible.builtin.copy: src: /home/archive/config.php dest: /home/roundcube/config.php when: sum.stat.checksum != sum2.stat.checksum
'... If this is not provided, ansible will use the local calculated checksum of the src file.'