Ansible

Ansible dashboard

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.

Setup

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
  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_DATADOG_API_KEY>
    
  5. Ansible events and metrics appear in Datadog after your playbook is run.

To install the Datadog Agent using Ansible, see the Agent Installation Instructions.

Log collection

See the playbook example to learn how to install the Datadog Agent with log collection enabled using Ansible.

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

Events

The ansible-datadog-callback captures Ansible events from your playbook runs.

Service Checks

The Ansible integration does not include any service checks.

Troubleshooting

Need help? Contact Datadog support.