How to display verbose only for a particular task in playbook?

461 views
Skip to first unread message

Vikram S

unread,
Jun 1, 2021, 4:07:40 PM6/1/21
to Ansible Project

I have several tasks in a playbook. I want to see -vvvv (highest verbose level) only for a single task in the playbook. So i don't want to give -vvvv after 'ansible-playbook sample.yaml'.

Is there any way to display -vvvv info only for a single task while running the playbook?


Thanks,

Vikram

Rajthecomputerguy

unread,
Jun 1, 2021, 9:30:01 PM6/1/21
to ansible...@googlegroups.com
I don't think there is a straightforward way.

As a workaround you could run the whole play with no_log: true and add no_log: false explicitly to your task calling ec2 action. Then run the playbook with -v.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d6d1c317-5a49-4f99-b6b4-7ffa0bbea24an%40googlegroups.com.


--

Thanks,

Pushparaj G


prasanna kumar

unread,
Jun 1, 2021, 11:30:21 PM6/1/21
to ansible...@googlegroups.com
There are log plugins specifically for these. You can refer logcallback plugin in ansible.

Create a copy of it and customize it as per your need.


--

pradnya waghmare

unread,
Jun 2, 2021, 2:40:58 AM6/2/21
to ansible...@googlegroups.com

Abhijeet Kasurde

unread,
Jun 2, 2021, 3:03:22 AM6/2/21
to ansible...@googlegroups.com

Vikram S

unread,
Jun 2, 2021, 12:53:35 PM6/2/21
to Ansible Project

Hi pushparaj,

The problem with this approach is that it is hiding even the normal output (success/fail, etc) of each task when i don't use -vvvv. So it is hiding output of each task that i would otherwise need to see. Thanks for replying though.

Regards,
Vikram

Vikram S

unread,
Jun 2, 2021, 1:03:08 PM6/2/21
to Ansible Project
Hi,

I tried this but it doesn't exactly meet my requirements. I need to run only a single task with highest level verbosity. If i were to specify verbosity level as 4 as given in the article and if i were to run -vvvv, then all other tasks which have lower verbosity will also show debug info, not just the single task that i want shown.

Regards,
Vikram

Brian Coca

unread,
Jun 2, 2021, 5:08:28 PM6/2/21
to Ansible Project
or we add this https://github.com/ansible/ansible/pull/74888




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

Reply all
Reply to author
Forward
0 new messages