get verbosity at runtime

14 views
Skip to first unread message

William McKenzie

unread,
Dec 20, 2017, 8:22:43 AM12/20/17
to Ansible Project
Is there a builtin variable that holds the verbosity passed in -vvvv ? I want to suppress output unless it is above a certain level. 

So, in  a task, i'd like to write:

no_log: "{{ verbosity <= 2 }}"

thanks,
~Bill

Matt Martz

unread,
Dec 20, 2017, 10:57:58 AM12/20/17
to ansible...@googlegroups.com
That is not currently possible.  Some of the command invocation options are exposed but not all:


Pull requests are welcome.

--
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-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/aeac3bee-341b-45e4-8b1d-25852fe77251%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net

Brian Coca

unread,
Dec 20, 2017, 11:13:23 AM12/20/17
to Ansible Project
the debug task has a verbosity setting for that purpose,
http://docs.ansible.com/ansible/latest/debug_module.html


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

William McKenzie

unread,
Dec 20, 2017, 11:32:31 AM12/20/17
to ansible...@googlegroups.com
Yes, but this doesn't help me. I know can control when my own debug statements happen. What I can't do is take a module that is overly verbose by default, and tamp down the noise based on the -v flags. For instance, the add_host module will print a bunch of stuff i may not want see, even if there is no -v flag. I can suppress this with no_log=True, but I what really want to do is only suppress it if there is no verbosity setting.



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

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/JkqMcX90f18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.

To post to this group, send email to ansible-project@googlegroups.com.

Brian Coca

unread,
Dec 20, 2017, 11:58:26 AM12/20/17
to Ansible Project
the modules themselves do have verbosity information
(module.verbosity) but it is not available to the task, even if there
were, there is no way to suppress output aside from no_log

--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages