This Ansible [callback plugin]() formats the output of an Ansible playbook, so that it can be better interpreted by TeamCity.
Because Ansible logs in Teamcity look like this:
With this plugin in place, they look like this:
All plays and tasks are nicely put into their own blocks allowing TeamCity to collapse them and calculate the different times.
You have different options of using this plugin:
callback_plugins
directly where your playbook livescallback_plugins
directoryexport ANSIBLE_CALLBACK_PLUGINS=<path of your plugin>
Set the following environment variable to use the plugin:
export ANSIBLE_STDOUT_CALLBACK=teamcity
Then run your playbook.