How to disable aysnc poll/ok/failed message output

Hello,

We recently upgraded ansible from 2.10 to 2.14 and have noticed ASYNC POLL/OK/FAILED messages are now displayed during async tasks. Where as before these messages where not displayed, is there any way to disable/hide these maessages from stdout?

Example output:
ASYNC POLL on host.fqdn jid=1234.6789 started=1 finished=0

The OK/FAILED messages are similar to the POLL message.

I have tried setting the following callback options in the config file to false, but they either don’t work or they are referenced in some other way.

If anyone knows how to remove these messages, it would be appreciated.

Thanks

Hi,

Just a thought, you could use diy callback plugin to this end. I don’t have an example tailored to your needs, but here is one to remove all headers and stats from output:

$ less ./ansible.cfg
[defaults]
stdout_callback = community.general.diy
...

$ less test.yml
---

- name: "Print some stuff"
  gather_facts: false
  connection: local
  hosts: localhost
  become: false
  vars:
    ansible_callback_diy_playbook_on_play_start_msg: ""
    ansible_callback_diy_playbook_on_stats_msg: ""
  tasks:
    - name: Print stuff
      ansible.builtin.debug:
        msg:
          - stuff
      vars:
        ansible_callback_diy_playbook_on_task_start_msg: ""
        ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.msg }}\n"

$ ANSIBLE_CONFIG=./ansible.cfg ansible-playbook test.yml
['stuff']

Hope it helps !

Hi,

Thanks for the suggestion, but I’ve actually already tried the diy stdout callback. The irony is that the async poll/ok/failed messages do not display by default using this stdout callback; which is great, however you can not format the results.

For example the callback parameters:

callback_format_pretty = true
callback_result_format = yaml

have no effect using the diy stdout callback under the [defaults] or [callback_diy] sections in the ansible.cfg file, so reading the errors are a pain.

So just to let others know, the solution to the issue was to modify the default callback for the python version being used.

%ansible python module location%/plugins/callback/default.py

%ansible python module location% = the python path ansible is using (ansible --version)

By commenting out the “v2_runner_on_async_poll/ok/failed” block sections I managed to remove the (IMO useless) async messages.

The DIY callback currently doesn’t include these async runners and as such does not show these messages, however the DIY callback also doesn’t currently support pretty formatting.

Hence this is why I modified the default callback instead since it was a simple solution and I am not ready to write my own callback just to remove those async messages.

Anyway, hopefully this helps others looking to remove these async messages as well.

2 Likes

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