I generate a report using a Jinja template file from one of my playbooks and mail that file to several users. In it, I am putting the current date and time as follows:
Date generated: {{ now(false, '%m/%d/%Y %I:%M:%S') }}
---
{% for i in play_hosts | sort %}
Host: {{ i }}
Rebooted: {{ hostvars[i]['rebooted']['rebooted'] }}
Total reboot time: {{ hostvars[i]['rebooted']['elapsed'] }} seconds
---
{% endfor %}
When I get the email, the date is correct but the time is 7 hours off. For example, the report was generated and mailed at 10:40:00am yesterday, but the time listed via the Jinja template above was 03:40:00.
Any ideas on how to get the time be in the current timezone?
Thanks,
Harry