How do I avoid showing skipped Ansible tasks?

Solution 1:

I use another way without changing any code:

Ansible use 'default' callback plugin to display output, but you can use 'skippy' callback plugin instead of 'default'. 'skippy' use 'default' except for skipped tasks.

To use 'skipped' plugin, add following line (or uncomment it) in your ansible.cfg file:

stdout_callback = skippy

To localize you ansible.cfg, use command:

ansible --version

If you don't have this file, get example file from ansible sources and copy it in your working folder from where you call ansible.

Solution 2:

Now, the skippy module is deprecated.

Create ansible.cfg at the root of your project, and add the following instructions:

display_skipped_hosts = no

You can also edit your global configuration file /etc/ansible/ansible.cfg.

Solution 3:

If the documentation says the header was still appears, then you can't avoid it unless you change the ansible behaviour by edit the code. If you still insist to edit it, then you can try to find file lib/ansible/ and add this line of string

msg = ''

before this line

display(msg, color='cyan', runner=self.runner)