Skip to content

profile_tasks

Collection Note

This module is part of the ansible.posix collection. To install the collection, use:

ansible-galaxy collection install ansible.posix

You need further requirements to be able to use this module, see the Requirements section for details.

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: C() C() C()
  • 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 following Python packages are needed on the host that executes this module:

Parameters

Parameter Defaults / Choices Comments
output_limit Default: 20
Number of tasks to display in the summary
Env: PROFILE_TASKS_TASK_OUTPUT_LIMIT
sort_order Default: descending
Choices: descending, ascending, none
Adjust the sorting output of summary tasks
Env: PROFILE_TASKS_SORT_ORDER
summary_only
bool
Only show summary, not individual task profiles. Especially usefull in combination with C(DISPLAY_SKIPPED_HOSTS=false) and/or C(ANSIBLE_DISPLAY_OK_HOSTS=false).
Env: PROFILE_TASKS_SUMMARY_ONLY
Version Added: 1.5.0

Examples

example: >
  To enable, add this to your ansible.cfg file in the defaults block
    [defaults]
    callbacks_enabled=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]
#