Timestamp formats in ansible

Hello,

I defined a timestamp variable used to name backup files:

backup_timestamp: “{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}{{ ansible_date_time.hour }}{{ ansible_date_time.minute }}{{ ansible_date_time.second }}”

I use that variable successfully in a command. My questions is: is there a way to define timestamp formats without manual appending of ansible_data_time’s components?

Regards
rambius

If you’re using ansible 2.0, now you can use “{{lookup(‘pipe’, ‘date +%Y%m%d%H%M%S’)}}” to get what you want.