添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
ansible-galaxy collection install datadog.dd

After you’ve installed the collection, you’ll need to create an inventory that specifies the hosts you want to monitor with Datadog. In the example below, we’ve created a simple inventory ( inventory.yaml ) using a mix of host names and IP addresses. Grouping your hosts by web , databases , and prod enable you to create and run playbooks that apply only to hosts in these subfields.

inventory.yaml

[web]
203.0.113.112
203.0.113.113
[databases]
us-west-db1
us-east-db1
[prod]
203.0.113.112
prod-us1

You can also create a dynamic inventory by using cloud provider tags to define the scope of your inventory; this ensures that the inventory will automatically update as new hosts are created. If you use AWS, you can check out this blog post to learn how to install Datadog on your EC2 hosts by creating a dynamic inventory.

Now that we have an inventory, it’s time to create our playbook ( datadog_playbook.yaml ) that installs the Agent on our inventory of hosts. We accomplish this by importing the Datadog role as shown below. In our example, we provide the Datadog API key as a string—however, we recommend encrypting your credentials with a solution such as Ansible Vault .

datadog_playbook.yaml

- name: Install the Datadog Agent 
  import_role:
        name: datadog.dd.agent
  vars:
    datadog_api_key: "<YOUR_API_KEY>"

We can now apply our playbook to our inventory. To install the Datadog Agent on all hosts within our inventory.yaml file, we can run the following command on our control node:

ansible-playbook -i inventory.yaml datadog_playbook.yaml

You can also easily configure your playbook to install Datadog integrations so you can gain full visibility across your environment. To learn more, check out our documentation for the agent role .

Start using Datadog’s Ansible collection

Datadog’s Ansible collection is now certified through Ansible Automation Hub and also available via Ansible Galaxy. Begin automating the installation and configuration of the Agent on your hosts today and gain access to new and advanced features that help you manage your infrastructure more efficiently. You can also follow these in-app instructions to configure the Agent. To learn more about using Datadog with Ansible, you can check out our documentation . Or, check out these blog posts on deploying the Agent on Windows environments using Ansible and installing the Agent on AWS hosts using Ansible dynamic inventories .

If you don’t already have a Datadog account, you can sign up for a today.