diff --git a/changelogs/fragments/11656-counter_enabled-display_ok_hosts.yml b/changelogs/fragments/11656-counter_enabled-display_ok_hosts.yml new file mode 100644 index 0000000000..ee0b97f506 --- /dev/null +++ b/changelogs/fragments/11656-counter_enabled-display_ok_hosts.yml @@ -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). diff --git a/plugins/callback/counter_enabled.py b/plugins/callback/counter_enabled.py index b8c34e6f6e..c28d6b44d9 100644 --- a/plugins/callback/counter_enabled.py +++ b/plugins/callback/counter_enabled.py @@ -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: