counter_enabled callback: honor display_ok_hosts setting (#11656)

* fix(callback/counter_enabled): honor display_ok_hosts setting

* add changelog frag

* Update changelogs/fragments/11656-counter_enabled-display_ok_hosts.yml
This commit is contained in:
Alexei Znamensky
2026-03-24 07:57:48 +13:00
committed by GitHub
parent 25a4f568f9
commit 4dad53abac
2 changed files with 4 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
bugfixes:
- counter_enabled callback plugin - fix plugin not observing ``display_ok_hosts`` option (https://github.com/ansible-collections/community.general/issues/3978, https://github.com/ansible-collections/community.general/pull/11656).

View File

@@ -157,6 +157,8 @@ class CallbackModule(CallbackBase):
msg = f"changed: {self._host_counter}/{self._host_total} [{result._host.get_name()}]"
color = C.COLOR_CHANGED
else:
if not self._plugin_options.get("display_ok_hosts", True):
return
if delegated_vars:
msg = f"ok: {self._host_counter}/{self._host_total} [{result._host.get_name()} -> {delegated_vars['ansible_host']}]"
else: