I am new to Ansible . I created EC2 instances using ansible and able to to retrieve the launch time using EC2 facts .
But i am unable to store the launch time in date format .
My goal is to get the difference of launch time date with system date (unable to find that also and perform some operations .
Any guidance is appreciated .
Regards, Naresh Sharma
Since Ansible 2.2 there is a handy
to_datetime(format)
filter available.Here is example for your task:
Note
[:19]
to get first 19 characters to avoid handling of milliseconds and timezone characters.Result: