ansible.posix.profile_tasks callback – adds time information to tasks
Note
This callback plugin is part of the ansible.posix collection (version 1.4.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install ansible.posix
.
To use it in a playbook, specify: ansible.posix.profile_tasks
.
Synopsis
Ansible callback plugin for timing individual tasks and overall execution time.
Mashup of 2 excellent original works: https://github.com/jlafon/ansible-profile, https://github.com/junaid18183/ansible_home/blob/master/ansible_plugins/callback_plugins/timestamp.py.old
Format:
<task start timestamp> (<length of previous task>
<current elapsed playbook execution time>)It also lists the top/bottom time consuming tasks in the summary (configurable)
Before 2.4 only the environment variables were available for configuration.
Requirements
The below requirements are needed on the local controller node that executes this callback.
whitelisting in configuration - see examples section below for details.
Parameters
Parameter |
Comments |
---|---|
Number of tasks to display in the summary Default: 20 Configuration:
|
|
Adjust the sorting output of summary tasks Choices:
Configuration:
|
Examples
example: >
To enable, add this to your ansible.cfg file in the defaults block
[defaults]
callback_whitelist = ansible.posix.profile_tasks
sample output: >
#
# TASK: [ensure messaging security group exists] ********************************
# Thursday 11 June 2017 22:50:53 +0100 (0:00:00.721) 0:00:05.322 *********
# ok: [localhost]
#
# TASK: [ensure db security group exists] ***************************************
# Thursday 11 June 2017 22:50:54 +0100 (0:00:00.558) 0:00:05.880 *********
# changed: [localhost]
#
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.