# get verbosity at runtime

**URL:** <https://forum.ansible.com/t/get-verbosity-at-runtime/26342>\
**Category:** Ansible Project\
**Created:** [December 20, 2017, 1:22pm UTC](https://forum.ansible.com/t/get-verbosity-at-runtime/26342 "2017-12-20T13:22:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_McKenzie](https://avatars.discourse-cdn.com/v4/letter/w/f14d63/32.png) [@William\_McKenzie](https://forum.ansible.com/u/William_McKenzie)\
**Post date:** [December 20, 2017, 1:22pm UTC](https://forum.ansible.com/t/get-verbosity-at-runtime/26342/1 "2017-12-20T13:22:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 20, 2017, 3:56pm UTC](https://forum.ansible.com/t/get-verbosity-at-runtime/26342/2 "2017-12-20T15:56:49Z")

</div>

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](https://github.com/ansible/ansible/blob/6e857468a222e3f1481b5da9b1372ccdf8099082/lib/ansible/utils/vars.py#L146-L160)

Pull requests are welcome.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [December 20, 2017, 4:13pm UTC](https://forum.ansible.com/t/get-verbosity-at-runtime/26342/3 "2017-12-20T16:13:05Z")

</div>

the debug task has a verbosity setting for that purpose,  
[http://docs.ansible.com/ansible/latest/debug\_module.html](http://docs.ansible.com/ansible/latest/debug_module.html)

---

<div class="post-metadata">

**Author:** ![William\_McKenzie](https://avatars.discourse-cdn.com/v4/letter/w/f14d63/32.png) [@William\_McKenzie](https://forum.ansible.com/u/William_McKenzie)\
**Post date:** [December 20, 2017, 4:32pm UTC](https://forum.ansible.com/t/get-verbosity-at-runtime/26342/4 "2017-12-20T16:32:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [December 20, 2017, 4:58pm UTC](https://forum.ansible.com/t/get-verbosity-at-runtime/26342/5 "2017-12-20T16:58:13Z")

</div>

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
