How should I avoid skipped tasks from displaying on the console

Hi,

I have couple of rollback task in the playbook, displayed as skipped tasked, on the console.

`
TASK: [deploy-stack | Deleting_Validation_Template] ***************************
skipping: [10.17.10.150]

TASK: [deploy-stack | shell echo ‘Template Validation has Failed’] ************
skipping: [10.17.10.150]

TASK: [deploy-stack | Deploying_the_Stack…] **********************************
changed: [10.17.10.150]
`

I am able to hide “skipping” tags under the task header with the help of “display_skipped_hosts” parameter in ansible.cfg file. However TASK is still displayed on the console.

Is there any way to achieve this ?

Thanks,

Not tried it myself but I believe there is a callback plugin called actionable which you can try which might do this.

See http://docs.ansible.com/ansible/developing_plugins.html#callbacks

Since this is a supplied callback plugin then I think you can enable it just by adding it to the callback_whitelist in your ansible.cfg - see http://docs.ansible.com/ansible/intro_configuration.html#callback-whitelist

Hope this helps,

Jon

Thanks for replay jhawkesworth,

There are good plugins, however it does not hide the skipped tasks.

I found this link but could not find “callbacks.py” file in “ansible/plugins/callback”. :frowning:

Is it better to own call plugin to achive this, or this functionality is available ? I am using ansible version 2.1

Thanks,

Since this is a supplied callback plugin then I think you can enable it just by adding it to the callback_whitelist in your ansible.cfg - see http://docs.ansible.com/ansible/intro_configuration.html#callback-whitelist

In ansible.cfg you need to set

stdout_callback = actionable

for it to be used for the output. It works, it only shows the changed: results.

the skippy is the one which ONLY hides skipped tasks, actionable also hides OK tasks.

Hi Brian,

I updated ansible.cfg file with “stdout_callback = skippy” however this plugin is hiding only notification tags “skipping”. It is not hiding “TASK” header.

`
TASK: [deploy-stack | Deleting_Validation_Template] ***************************

TASK: [deploy-stack | shell echo ‘Template Validation has Failed’] ************

TASK: [deploy-stack | Deploying_the_Stack…] **********************************
changed: [10.17.10.150]
`

Where, “Deleting_Validation_Template” and “shell echo ‘Template Validation has Failed’” are the “skipped” tasks.

Thanks,

task headers get printed before a task gets attempted for any of the hosts, the callback hides the skipped hosts but cannot ‘unprint’ the headers if all hosts skip the task.

The only way to do that would be to buffer the output and wait until all hosts skip.

Thanks for the replay Brian,

So If I understood correctly, In order to achieve this, I need to write custom “callback_plugins” which can buffer the output until all hosts skip in the playbook.

If answer is positive, I will try this out ans update.

Thanks,

Tejas,

Did you attempt writing a module which buffers output and only prints header if task is not skipped. If yes, would be great if you can provide me some pointers.

Thx!
Arjav

I found this thread, looking for a similar solution.

What worked for me was to set the following under the [defaults] section in my ansible.cfg file:

display_skipped_hosts = False

See for more info: http://docs.ansible.com/ansible/intro_configuration.html#display-skipped-hosts

If you try with free mode, it will work.