CK LZEM7
CK LZEM7

Reputation: 31

Printing an ansible task elapsed time into a log file

I have a playbook that I have developed and I want to log the elapsed time of each execution of that playbook to log file. I have already enabled callback_plugins, but I do not know how to print them to a log file. Is there a way to register the elapsed time into a variable or is there a mechanism that I have missed to do this task

Upvotes: 0

Views: 983

Answers (1)

bosari
bosari

Reputation: 2000

For ansible > 2.0, the plugin named callback comes as built-in. To enable add the shown directive to ansible.cfg. I have used and it is working as expected.

#/etc/ansible/ansible.cg

callback_whitelist = profile_tasks

Also, login is off by default so provide a log path. For example -

# Logging is off by default unless this path is defined.
#log_path = /var/log/ansible.log

Upvotes: 1

Related Questions