<p>You can add an entry in your ini file to set the sort_order for the callback plugin to none. </p>

<pre><code>[callback_profile_tasks]
sort_order = none
</code></pre>

<p>By default it is set to descending, which is why the tasks are displayed in decreasing order of time taken.</p>

<p>Refer: <a href="https://docs.ansible.com/ansible/latest/plugins/callback/profile_tasks.html#parameter-sort_order" rel="nofollow noreferrer">https://docs.ansible.com/ansible/latest/plugins/callback/profile_tasks.html#parameter-sort_order</a></p>

CC BY-SA 4.0
2020-06-02T16:51:09.810Z
2020-06-02T16:51:09.810Z
Karthick Prabu
<p>I've configured ansible.cfg to display the steps it has done during a playbook run and it looks like so:</p>

<pre><code>===============================================================================
common : Upgrade all packages --------------------------------------- 407.33s
jenkins-slave : compile git --------------------------------------- 153.26s
jenkins-slave : clone tss repo --------------------------------------- 44.61s
jenkins-slave : remove current git installation --------------------------------------- 24.22s
jenkins-slave : install java 1.8.0 --------------------------------------- 16.61s
jenkins-slave : download git source --------------------------------------- 12.44s
jenkins-slave : Install required packages --------------------------------------- 10.83s
jenkins-slave : clone repo --------------------------------------- 9.02s
common : Install base packages --------------------------------------- 6.74s
jenkins-slave : install nvm --------------------------------------- 5.72s
common : install pip --------------------------------------- 5.21s
common : Install base packages centos 7 --------------------------------------- 3.53s
node-exporter : download node-exporter tarball --------------------------------------- 2.83s
jenkins-slave : create "/opt/devenv/company" --------------------------------------- 1.97s
common : download pip --------------------------------------- 1.80s
Gathering Facts --------------------------------------- 1.69s
common : install pip packages --------------------------------------- 1.66s
jenkins-slave : unarchive git source --------------------------------------- 1.46s
node-exporter : untar node-exporter tarball --------------------------------------- 1.32s
</code></pre>

<p>ansible.cfg is configured like so:</p>

<pre><code>[defaults]
nocows = 1
nocolor = 0
retry_files_enabled   = False
display_skipped_hosts = True
host_key_checking = False
transport = paramiko
bin_ansible_callbacks = True
callback_whitelist = profile_tasks
forks = 25
[ssh_connection]
transfer_method = scp
</code></pre>

<p>If you see from the output, the order is all mixed up and is sorted by the length of each task's run in descending order.</p>

<p>How can I sort the output so it displays the tasks by the order they were run?</p>

<ansible>
How to sort displayed tasks in the order they were run rather than by the time it took each task to run?
Itai Ganot
# How to sort displayed tasks in the order they were run rather than by the time it took each task to run?

(Asked by: username_0 on 2020-05-24)

I've configured ansible.cfg to display the steps it has done during a playbook run and it looks like so:
===============================================================================
common : Upgrade all packages --------------------------------------- 407.33s
jenkins-slave : compile git --------------------------------------- 153.26s
jenkins-slave : clone tss repo --------------------------------------- 44.61s
jenkins-slave : remove current git installation --------------------------------------- 24.22s
jenkins-slave : install java 1.8.0 --------------------------------------- 16.61s
jenkins-slave : download git source --------------------------------------- 12.44s
jenkins-slave : Install required packages --------------------------------------- 10.83s
jenkins-slave : clone repo --------------------------------------- 9.02s
common : Install base packages --------------------------------------- 6.74s
jenkins-slave : install nvm --------------------------------------- 5.72s
common : install pip --------------------------------------- 5.21s
common : Install base packages centos 7 --------------------------------------- 3.53s
node-exporter : download node-exporter tarball --------------------------------------- 2.83s
jenkins-slave : create "/opt/devenv/company" --------------------------------------- 1.97s
common : download pip --------------------------------------- 1.80s
Gathering Facts --------------------------------------- 1.69s
common : install pip packages --------------------------------------- 1.66s
jenkins-slave : unarchive git source --------------------------------------- 1.46s
node-exporter : untar node-exporter tarball --------------------------------------- 1.32s

ansible.cfg is configured like so:
[defaults]
nocows = 1
nocolor = 0
retry_files_enabled   = False
display_skipped_hosts = True
host_key_checking = False
transport = paramiko
bin_ansible_callbacks = True
callback_whitelist = profile_tasks
forks = 25
[ssh_connection]
transfer_method = scp

If you see from the output, the order is all mixed up and is sorted by the length of each task's run in descending order.
How can I sort the output so it displays the tasks by the order they were run?

**Tags:** ansible


---

## 1 answers

### Answer by username_1 on 2020-06-02. Score: 1

You can add an entry in your ini file to set the sort_order for the callback plugin to none. 
[callback_profile_tasks]
sort_order = none

By default it is set to descending, which is why the tasks are displayed in decreasing order of time taken.
Refer: https://docs.ansible.com/ansible/latest/plugins/callback/profile_tasks.html#parameter-sort_order


---

