# Any way to see ansible.builtin.debug messages while skipping OK hosts?

**URL:** <https://forum.ansible.com/t/any-way-to-see-ansible-builtin-debug-messages-while-skipping-ok-hosts/42252>\
**Category:** Get Help\
**Tags:** callback, playbook\
**Created:** [April 29, 2025, 11:31am UTC](https://forum.ansible.com/t/any-way-to-see-ansible-builtin-debug-messages-while-skipping-ok-hosts/42252 "2025-04-29T11:31:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![grifferz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/grifferz/32/377_2.png) [@grifferz](https://forum.ansible.com/u/grifferz)\
**Post date:** [April 29, 2025, 11:31am UTC](https://forum.ansible.com/t/any-way-to-see-ansible-builtin-debug-messages-while-skipping-ok-hosts/42252/1 "2025-04-29T11:31:44Z")

</div>

I normally run playbooks with `display_ok_hosts = no` as I don’t want to see a big list of tasks that didn’t do anything. That does mean that messages from `ansible.builtin.debug` tasks are also totally skipped.

If I _do_ really want to show a message in the stdout of `ansible-playbook` while still skipping the printing of OK tasks, what are my options?

Do I need to use an entirely different custom stdout callback that knows to ignore OK tasks unless they are messages from `debug`? Is there a module other than `ansible.builtin.debug` I could use for the same purpose but it’s not treated as skippable debug?

Or, the `display_ok_hosts = no` is set in `ansible.cfg` so would setting that (to yes) as a parameter on the debug module override that for just that one debug message task?

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [April 29, 2025, 12:36pm UTC](https://forum.ansible.com/t/any-way-to-see-ansible-builtin-debug-messages-while-skipping-ok-hosts/42252/2 "2025-04-29T12:36:35Z")

</div>

You could use `changed_when` so it shows up based on some jinja2 expression [Error handling in playbooks — Ansible Community Documentation](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_error_handling.html#defining-changed).

---

<div class="post-metadata">

**Author:** ![grifferz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/grifferz/32/377_2.png) [@grifferz](https://forum.ansible.com/u/grifferz)\
**Post date:** [April 29, 2025, 1:06pm UTC](https://forum.ansible.com/t/any-way-to-see-ansible-builtin-debug-messages-while-skipping-ok-hosts/42252/3 "2025-04-29T13:06:25Z")

</div>

> [@shertel](#):
>
> You could use `changed_when` so it shows up based on some jinja2 expression

Oh right, so if I always wanted a particular debug message to show up I could use `changed_when: true` and that would change the status of the task from “OK” to “changed” and it wouldn’t be skipped for display?

Update: Yes, this works nicely. Thanks!

---

<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:** [May 29, 2025, 1:07pm UTC](https://forum.ansible.com/t/any-way-to-see-ansible-builtin-debug-messages-while-skipping-ok-hosts/42252/4 "2025-05-29T13:07:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
