Profiling Ansible roles and tasks

Performance is critical when deploying an environment with Ansible. By default Ansible does not tell how much time elapsed for specific role or task. However, this information would be critical to identify inefficient tasks. Luckily Ansible offers an interface for callback plugins. With the help of a callback plugin one can hook into the role or task execution call. In this post I’ll show you how to configure the callback plugins for profiling roles and tasks. It is quite easy.

First create a plugin folder in your Ansible project.

mkdir callback_plugins

Step into the directory and download the plugins from the Ansible repo.