You're using the "debug:" module to set the "msg" variable so the date
value isn't in the "{{ msg }}" variable, rather it's in the "{{ msg.msg }}"
variable.
Try these lines in stead:
- name: FIXED - age of file in days stored in msg
set_fact:
msg: "{{ (ansible_date_time.epoch|int -
So I have resolved my issue thanks to others advice what worked is to
1. stat the file get its mtime and
2. register and
3. assign it to a variable and the same for the current date and
4. put both variables and include to convert them to an INT into a jinja
subtraction arithmetic and divide