get verbosity at runtime

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

That is not currently possible. Some of the command invocation options are exposed but not all:

https://github.com/ansible/ansible/blob/6e857468a222e3f1481b5da9b1372ccdf8099082/lib/ansible/utils/vars.py#L146-L160

Pull requests are welcome.

the debug task has a verbosity setting for that purpose,
http://docs.ansible.com/ansible/latest/debug_module.html

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.

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