current run timestamp

22 views
Skip to first unread message

ordered...@gmail.com

unread,
Mar 20, 2018, 6:27:59 PM3/20/18
to Ansible Project
I want to set it up so there is a current ansible playbook run timestamp set at the start of every playbook run so I can use this var in various roles.
The only way so far I have found is to set a pre_task with set fact in every playbook.
Does anyone have any suggestions or information on a current playbook run start timestamp or a way to set this var so that I dont need to add the set_fact to every playbook?

Kai Stian Olstad

unread,
Mar 26, 2018, 4:34:20 AM3/26/18
to ansible...@googlegroups.com
You always have access to the hostvars['localhost'].ansible_date_time

You also have this variable on every host if you gather facts, since
facts is gathered at different times that time will differ between host,
but the one on localhost is consistent through the run.

--
Kai Stian Olstad

Bishwajit Samanta

unread,
Apr 12, 2018, 3:57:37 AM4/12/18
to Ansible Project
[defaults]
I used callback_whitelist = profile_tasks 

You can set it in ansible.cfg. 

That can solve your problem i guess.
Reply all
Reply to author
Forward
0 new messages