Datadog-Ansible Integration

Overview

Install the Datadog Ansible callback integration to:

  • Get real-time reports on Ansible server runs
  • Track key Ansible performance metrics across all your servers
  • Quickly identify and discuss failed Ansible runs with your team

For more information about using our integration with Ansible, read this post on our blog.

Setup

Installation

  1. Ensure the prerequisite python libraries are installed on the server:

    • datadogpy
    • pyyaml (install with pip install pyyaml)
  2. Clone the ansible-datadog-callback GitHub repo.

  3. Copy datadog_callback.py to your playbook callback directory (by default callback_plugins/ in your playbook’s root directory). Create the directory if it doesn’t exist.

  4. Create a datadog_callback.yml file alongside datadog_callback.py, and set its contents with your API key, as following:

    api_key: <your-api-key>
    
  5. You should start seeing Ansible events and metrics appear on Datadog when your playbook is run.

To install the Datadog Agent using Ansible, refer to the installation documentation here.

Data Collected

Metrics

ansible.elapsed_time
(gauge)
Time taken to execute a playbook
shown as second
ansible.task.ok
(gauge)
Number of tasks that did not require any change
shown as task
ansible.task.failures
(gauge)
Number of tasks that failed
shown as task
ansible.task.skipped
(gauge)
Number of tasks that got skipped
shown as task
ansible.task.unreachable
(gauge)
Number of tasks for which nodes were unreachable
shown as task
ansible.task.changed
(gauge)
Number of tasks that successfully applied changes
shown as task

Troubleshooting

Need help? Contact Datadog Support.