Reputation: 715
I use three settings in my ansible.cfg file to hide as much "useless" output as possible.
display_skipped_hosts = False
display_ok_hosts = False
stdout_callback = yaml
Now I have a big playbook where a lot of hosts are involved and each host also skips many roles only needed for other hosts. It looks like this:
- name: an example what my playbook might look like
hosts: many
roles:
- role: admin
when: inventory_hostname == 'admin'
- role: foo
when: "inventory_hostname in groups['bar']"
# ...
This only shows the failed and changed tasks but not the skipped and ok tasks. The problem is that I see a lot of filler lines from the skipped and ok tasks that I can not get rid of:
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.043) 0:00:02.360 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.028) 0:00:02.388 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.025) 0:00:02.413 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.024) 0:00:02.438 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.029) 0:00:02.468 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.025) 0:00:02.493 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.023) 0:00:02.517 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.024) 0:00:02.541 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.024) 0:00:02.566 *******
Tuesday 08 October 2019 14:19:16 +0200 (0:00:00.025) 0:00:02.591 *******
This is bad as it forces me to skroll a lot to find that one line that changed.
Can I get rid of these filler lines as well? How so?
Upvotes: 2
Views: 2666
Reputation: 1658
My answer applies to Ansible 2.9, and probably versions since 2.7 (not tested). Ansible is making changes to the structure of the the output plugins, so earlier versions of Ansible may require a different approach.
This output comes from the profiling plugins. The settings you listed only affect the default plugin.
To remove the output from the profiling plugins, you have to disable them. In your ansible.cfg, edit the line
callback_whitelist ...
and remove the entries profile_roles and profile_tasks.
You can also use an environment variable to accomplish the same thing.
Upvotes: 2