[PR #11656/4dad53ab backport][stable-12] counter_enabled callback: honor display_ok_hosts setting (#11667)

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

(cherry picked from commit 4dad53abac)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot]
2026-03-23 20:34:43 +01:00
committed by GitHub
parent 9d7097ef4d
commit a12ac59223
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: