Ansible

Description

The Datadog Ansible collection, datadog.dd, is the official collection of Ansible-related Datadog content. It contains the Ansible Datadog Role, which can be accessed as datadog.dd.agent, allowing you to install and configure the Datadog Agent and integrations. Agent version 7 is installed by default.

Requirements

  • Ansible v2.10+.

  • Supports most Debian, RHEL-based and SUSE-based Linux distributions, macOS, and Windows.

  • To manage Windows hosts, install the ansible.windows collection:

    ansible-galaxy collection install ansible.windows
    
  • When managing openSUSE/SLES hosts, install the community.general collection:

    ansible-galaxy collection install community.general
    

Installation

Before using this collection, install it with the Ansible Galaxy command-line tool:

ansible-galaxy collection install datadog.dd

Alternatively, include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml. Include the following in requirments.yml:

collections:
  - name: datadog.dd

Note: If you install the collection from Ansible Galaxy, it will not be upgraded automatically when you upgrade the Ansible package. To upgrade the collection to the latest available version, run the following command:

ansible-galaxy collection install datadog.dd --upgrade

You can install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). The following syntax shows how to install version 5.0.0:

ansible-galaxy collection install datadog.dd:==5.0.0

See using Ansible collections for more details.

The Datadog Ansible collection is also available through the Red Hat Automation Hub, where it is officially certified by Red Hat.

Use cases

To deploy the Datadog Agent on hosts, add the Datadog role and your API key to your playbook:

- hosts: servers
  tasks:
    - name: Import the Datadog Agent role from the Datadog collection
      import_role:
        name: datadog.dd.agent
  vars:
    datadog_api_key: "<YOUR_DD_API_KEY>"

Note: If you install the collection through the Ansible Automation Hub, OpenSUSE/SLES functionality depends on a community collection community.general. Red Hat Support does not provide support for issues related to community content. Direct all support issues for OpenSUSE/SLES to Datadog Support.

Testing

The Datadog Collection is tested on CentOS, Debian, Rocky Linux, OpenSUSE, Windows and macOS. Tests are run with latest ansible-lint version and sanity checks running with Python 3.9 to Python 3.12.

Support

If you need support, you can create in issue in the ansible-collections GitHub repo, or contact Datadog Support.

Release motes

You can follow changes in the CHANGELOG file.

Further reading

License information

The Datadog Ansible collection is published under Apache License 2.0.