I need to display the date-time that a file was last updated.
The value can be obtained with stat on the file:
- name: Get file stats
stat: path=“{{ path_of_file }}”
register: reg
- debug:
msg: “Timestamp of {{path}}: {{reg.stat.mtime}}”
However the output is meaningless because it is a float value.
The only solution I could find requires the creation of a custom filter: https://stackoverflow.com/questions/41084097/ansible-cast-float-to-date
Is there a simpler way?
Thank you all.
Jim