Skip to content

dodevops/ansible-teamcity-callback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Callback Plugin for Teamcity

Introduction

This Ansible callback plugin formats the output of an Ansible playbook, so that it can be better interpreted by TeamCity.

Why?

Because Ansible logs in Teamcity look like this:

Log without this plugin

With this plugin in place, they look like this:

Log with this plugin

All plays and tasks are nicely put into their own blocks allowing TeamCity to collapse them and calculate the different times.

Usage

You have different options of using this plugin:

  • In your playbook repository:
    • Create a folder named callback_plugins directly where your playbook lives
    • Download the file teamcity.py and place it in inside the callback_plugins directory
  • Somewhere else:
    • Download or clone the plugin, unzip it and place the folder somewhere accessible (i.e. use the Teamcity tools feature to distribute the plugin to all agents)
    • Use the following environment variable to tell Ansible where to find your plugin:
      export 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.