Ansible: resolving error “Invalid callback for stdout specified: yaml”

If you are getting the following error when invoking an Ansible playbook or any of the Ansible related utilities:

ERROR! Invalid callback for stdout specified: yaml

This means Ansible is attempting to use the new YAML callback plugin, but cannot find the Ansible Galaxy community.general module.  This module is installed by the ‘ansible’ pip module, but is NOT installed by default if you installed the lighter-weight ‘ansible-core’.

If you have the YAML callback module in your ansible.cfg like below:

# check for yaml callback module
$ grep callback ansible.cfg 
stdout_callback = yaml
bin_ansible_callbacks = True

Then you need to make sure the Ansible Galaxy community.general module is installed.

# list installed modules
ansible-galaxy collection list

# install module
ansible-galaxy collection install community.general

Once installed, the original error should be resolved.

 

REFERENCES

stackoverflow.com – explains use of stdout_callback and need for community.general

github ansible workshops issue, error and resolution

github ansible workshops issue, another time this same error and resolution was suggested

github ansible issue, explains that module is no longer maintained in core repo and is instead in community.general

docs, community.general.yaml callback

Ansible Galaxy, community.general module