I have a situation where I need to check the last modified date for a file using ansible. Normally stat in linux has the properties for the file like Modified,access and changed. I know p.stat.isdir and p.stat.pw_name exist but do we have a similar option using ansible stat to check last modified date of a file?
Ansible has a module with the same name stat
.
Its return values contain mtime
which is what you are looking for.
mtime
Time of last modification
Returned: success, path exists and user can read stats