---
title: Ansible
description: Ansible is a powerful automation tool for apps and IT infrastructure.
breadcrumbs: Docs > Integrations > Ansible
---

# Ansible

{% image
   source="https://datadog-docs.imgix.net/images/integrations/ansible/ansibledashboard.5e6c39f3ea027a77a38df7b47b2d0ff5.png?auto=format"
   alt="Ansible dashboard" /%}

## Overview{% #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 Datadog integrations with Ansible, read the blog post [Ansible + Datadog: Monitor your automation, automate your monitoring](https://www.datadoghq.com/blog/ansible-datadog-monitor-your-automation-automate-your-monitoring).

## Setup{% #setup %}

### Installation{% #installation %}

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

   - datadogpy
   - pyyaml (install with `pip install pyyaml`)
   - For Mac OS X users: If you're running OS-installed Python 2.7.10 or below, upgrade to a newer version of OpenSSL - `pip install pyopenssl idna`

1. Clone the [ansible-datadog-callback GitHub repo](https://github.com/datadog/ansible-datadog-callback).

1. 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.

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

   ```
    api_key: <YOUR_DATADOG_API_KEY>
   ```

1. Ansible events and metrics appear in Datadog after your playbook is run.

To install the Datadog Agent using Ansible, see the [Agent Installation Instructions](https://app.datadoghq.com/account/settings/agent/latest?platform=ansible).

### Log collection{% #log-collection %}

See the [playbook example](https://github.com/DataDog/ansible-datadog#example-playbooks) to learn how to install the Datadog Agent with log collection enabled using Ansible.

## Data Collected{% #data-collected %}

### Metrics{% #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* |

### Events{% #events %}

The [ansible-datadog-callback](https://github.com/datadog/ansible-datadog-callback) captures Ansible events from your playbook runs.

### Service Checks{% #service-checks %}

The Ansible integration does not include any service checks.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
