How should I avoid skipped tasks from displaying on the console

6,533 views
Skip to first unread message

Tejas Gadaria

unread,
Jun 6, 2016, 3:19:39 AM6/6/16
to Ansible Development
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,





jhawkesworth

unread,
Jun 6, 2016, 3:33:35 AM6/6/16
to Ansible Development
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


On Monday, June 6, 2016 at 8:19:39 AM UTC+1, Tejas Gadaria wrote:
Hi,

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

TASK: [deploy-stack | Deleting_ValidaItion_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]

Tejas Gadaria

unread,
Jun 6, 2016, 10:08:06 AM6/6/16
to jhawkesworth, Ansible Development
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".  :( 


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


Thanks,


--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-devel/g1DpMTdj09I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-deve...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tobias Wolf

unread,
Jun 6, 2016, 10:44:19 AM6/6/16
to Ansible Development, j.r.haw...@googlemail.com
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.

Brian Coca

unread,
Jun 6, 2016, 7:37:12 PM6/6/16
to Tobias Wolf, Ansible Development, jhawkesworth
the skippy is the one which ONLY hides skipped tasks, actionable also hides OK tasks.


----------
Brian Coca

Tejas Gadaria

unread,
Jun 6, 2016, 10:42:15 PM6/6/16
to Ansible Development, tow...@gmail.com, j.r.haw...@googlemail.com
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,

Brian Coca

unread,
Jun 6, 2016, 10:44:53 PM6/6/16
to Tejas Gadaria, Ansible Development, Tobias Wolf, jhawkesworth
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.


----------
Brian Coca

Tejas Gadaria

unread,
Jun 6, 2016, 11:26:58 PM6/6/16
to Ansible Development, refon...@gmail.com, tow...@gmail.com, j.r.haw...@googlemail.com
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,

Arjav Shah

unread,
Jan 23, 2017, 9:53:16 AM1/23/17
to Ansible Development, refon...@gmail.com, tow...@gmail.com, j.r.haw...@googlemail.com
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

Rory Bramwell

unread,
Jun 23, 2017, 12:22:35 PM6/23/17
to Ansible Development, refon...@gmail.com, tow...@gmail.com, j.r.haw...@googlemail.com
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

max.me...@gmail.com

unread,
Aug 25, 2017, 3:42:59 PM8/25/17
to Ansible Development
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
However TASK is still displayed on the console. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You have no way to hide the TASK line on the console. It was print out before running the task, that means, there is no "skipped" status yet while print the "TASK" line.

Option is: merge the line into the report of the task running.

max.me...@gmail.com

unread,
Aug 28, 2017, 5:43:46 PM8/28/17
to Ansible Development
If you try with free mode, it will work.
Reply all
Reply to author
Forward
0 new messages