Difficulty: Beginner
Estimated Time: 10 minutes

datadog ansible integrations

  • perform two integrations:
    • launch datadog agent on host01 and host02
    • put metrics/events/alerts from ansible activity related to host01 and host02 in your datadog dashboard
  • requirements:

    • basic linux command line
    • datadog account or trial instance with dashboard and api key
  • training environment:

    • Two ubuntu 16.04 instances [host01 and host02], using /root/ home directory
    • foreground.sh file downloads and starts ansible as well as declares some variables
    • background.sh file sets up a directory for callback plugins, git clones datadog agent repo, and git clones ansible callback module repo, downloads python, runs the setup.py to activate the datadog_agent

[project repo]:


[my links]:


linkedin software freedom school board

Curriculum Developer Interview #3 - Ansible

Step 1 of 3

Step 1

set up api key

  • get api key from your datadog dashboard
    • hover over Integrations on the left-side menu, click APIs
    • click 'API Keys' drop-down on next page
    • copy the long alphanumeric number under "Key"

replace in the below command with your actual Datadog api key, run it in your training terminal

  • export DATADOG_API_KEY=<insertyourapikeyhere>

    (HINT: cat the manual commands file cat manual_bash_commands, more info on that below)

Before moving to step2, review the important files and directories for this exercise:

in the training terminal, list the files in your current directory with ls command

notes on the files:

  • ansible-datadog-callback (directory) contains the datadog_callback.py which reads and sends ansible metrics/events data to datadoghq. Set up for this environment should copy the ansible_datadog_callback.py file up to this home directory

  • datadog_callback.py

    A callback to send Ansible events and metrics to Datadog, uses the datadog agent: cat ansible-datadog-callback/datadog_callback.py

  • datadog_callback.yml

    is read by the 'datadog_callback.py' to read your dd api key: cat datadog_callback.yml

  • datadogpy (directory) contains the setup.py which reads and sends system metrics/events data to datadoghq (statsd)

  • setup.py

    python script to install the datadog Agent: cat datadogpy/setup.py

  • ansible.yml

    ansible playbook that launches the datadog agent and turns each host into a web-server with a custom home page: less ansible.yml

  • hosts

    inventory file for ansible, pre-populated with host01 and host02: cat hosts

  • manual_bash_commands

    list of the commands to be run in this exercise. cat manual_bash_commands