惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
IT之家
IT之家
S
SegmentFault 最新的问题
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
J
Java Code Geeks
博客园 - 聂微东
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
博客园_首页
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 【当耐特】
腾讯CDC
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
宝玉的分享
宝玉的分享
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客
NISL@THU
NISL@THU
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
L
LINUX DO - 热门话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
F
Fortinet All Blogs
博客园 - Franky
L
Lohrmann on Cybersecurity
S
Secure Thoughts
量子位
V
Vulnerabilities – Threatpost
Last Week in AI
Last Week in AI
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LINUX DO - 最新话题
I
InfoQ
C
CERT Recently Published Vulnerability Notes
Security Archives - TechRepublic
Security Archives - TechRepublic
P
Proofpoint News Feed
G
GRAHAM CLULEY
Cisco Talos Blog
Cisco Talos Blog

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis Monitor Aruba Central in Datadog How we centralize and remediate risks with Datadog Case Management Accelerate incident response with Datadog and ServiceNow Monitor your application and network load balancer logs Understanding Karpenter architecture for Kubernetes autoscaling Tools for collecting metrics and logs from Karpenter Monitor Karpenter with Datadog What your product data is actually saying Key metrics for monitoring Karpenter Securing Datadog’s platform in the AI age: The role of observability data Four ways engineering teams use the Datadog MCP Server to power AI agents Approaching your observability migration with the right mindset Meet the new Bits AI SRE: Deeper reasoning, twice as fast Key learnings from the 2026 State of DevSecOps study Use plain English to query your multi-cloud infrastructure in Resource Catalog Simplifying troubleshooting across the user journey with Datadog Synthetic Monitoring Protect your OCI resources with Datadog Cloud Security This Month in Datadog - February 2026 Amazon EC2 security: How misconfigured and public AMIs expand your cloud attack surface Enable end-to-end visibility into your Java apps with a single command Measure and improve mobile app startup performance with Datadog RUM Evaluating our AI Guard application to improve quality and control cost Identify untested code across every level of your codebase Make use of guardrail metrics and stop babysitting your releases Monitor Versa Networks SD-WAN performance in Datadog Improve performance and reliability with APM Recommendations Remediate transitive vulnerabilities faster with Datadog Software Composition Analysis Generate audit-ready vulnerability and compliance reports with Datadog Sheets Monitor Fortinet FortiManager performance in Datadog Improve test coverage across codebases with Datadog Code Coverage Move fast, don’t break things: Consistent testing standards at scale Enrich logs with ServiceNow CMDB context before routing to any SIEM or logging tool Monitor Lustre with Datadog Make faster, better product decisions with Datadog Product Analytics Surface and remediate runtime posture issues with Workload Protection Findings Protect agentic AI applications with Datadog AI Guard How to optimize JavaScript code with CSS Trace Google Pub/Sub workloads in Cloud Run with Datadog Detect human names in logs with ML in Sensitive Data Scanner How we cut our NLQ agent debugging time from hours to minutes with LLM Observability Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring Datadog acquires Propolis Unify and correlate frontend and backend data with retention filters Scale compliance across global frameworks with Datadog Cloud Security Monitor Arista VeloCloud SD-WAN performance with Datadog Building reliable dashboard agents with Datadog LLM Observability Simplify log collection and aggregation for MSSPs with Datadog Observability Pipelines Mitigation for Node.js denial-of-service vulnerability affecting Datadog APM Automate flaky test fixes with the Bits AI Dev Agent and Test Optimization How we built an AI SRE agent that investigates like a team of engineers Datadog integrations 2025 recap: Observability for AI, security, and hybrid cloud Design effective executive dashboards with Datadog Implement dbt data quality checks with dbt-expectations Bring faster visibility into AWS Lambda functions with remote instrumentation Troubleshoot faster with the GitLab Source Code integration in Datadog How Cambia Health Solutions saved $30,000 monthly with Cloud Cost Management and the Datadog Resource Catalog Normalize any logs for Cloud SIEM with Datadog's OCSF processor Optimizing Datadog at scale: Cost-efficient observability at Zendesk Detect, diagnose, and resolve network issues easily with CNM Network Health Connect engineering errors to user impact in early-stage products Cilium configuration for Kubernetes operations at scale Designing feedback loops for progressive delivery Ship features faster and safer with Datadog Feature Flags Choosing the right OpenTelemetry Collector distribution Route your monitor alerts with Datadog monitor notification rules Automate Cloud SIEM investigations with Bits AI Security Analyst Cloud threat detection: How to identify risky activity across control and data planes Collecting Kafka performance metrics Monitoring Kafka with Datadog Monitoring Kafka performance metrics
How to install Datadog on AWS hosts with Ansible dynamic inventories
Ryan Hennessy, Mallory Mooney · 2019-07-23 · via Datadog | The Monitor blog

Ansible is an automation tool for provisioning, managing, and deploying infrastructure and applications. When building large-scale applications, Ansible enables users to manage and configure their infrastructure across platforms like AWS. Whether you rely on temporary or dedicated hosts, you can use Ansible to create a repeatable process for configuring them with the Datadog Agent. This process is especially useful if you need to monitor a dynamic inventory of resources (e.g., tagged EC2 instances) because Ansible can automatically manage these ephemeral resources.

In this post, you’ll learn how to:

  • install the Datadog Agent Ansible role

  • create a dynamic inventory of AWS EC2 instances in a single region

  • create an Ansible playbook that automatically deploys the Agent to the dynamic inventory

  • monitor your Ansible-managed instances with Datadog

With Ansible, you can consistently deploy and configure the Datadog Agent across your instances so you can monitor them in Datadog.

Custom dashboard for monitoring Ansible inventory

Though we focus on AWS EC2 in this guide, you can also create inventories for other platforms such as Kubernetes, Azure, and GCP. The following sample configurations serve as starting points for setting up EC2 instances with Ansible. For production-ready configurations, you can use Ansible vault with your playbooks to manage and secure all of your keys.

Get started with Ansible

Ansible manages instances through playbooks and inventories. Inventory files list all hosts or groups of hosts that are available in your infrastructure. Ansible playbooks are configuration management files used to execute the steps needed to create those new instances. Playbooks are designed to be idempotent, meaning that regardless of whether you run playbooks on your instances once or multiple times, your servers always end up in the same desired state. With these configurations, you can install the Datadog Agent in order to monitor all of the hosts (e.g., EC2 instances) that make up your application’s infrastructure.

There are a few prerequisites for getting started:

  • an AWS IAM user with access and secret key pairs and (at least) the AmazonEC2FullAccess permission policy to interact with the AWS API

  • an up-to-date version (2.8 at the time of this publication) of Ansible on your host machine, where you will create the playbook and inventory file and configure the Datadog Agent

  • the ability to SSH into the EC2 instances you want to manage and monitor with Ansible and Datadog

Verify initial configuration

You can verify your Ansible installation by checking that you have a default ansible.cfg configuration file on your host—typically located in the /etc/ansible/ directory on Linux hosts. Alternatively, you can copy the default configuration file and add it to the same directory. With Ansible installed, you can use it to download the Datadog Agent onto your host as an Ansible role. This enables you to easily install the Agent on all of your instances and automatically monitor your Ansible deployments.

Install the Datadog Agent Ansible role

You can use Ansible roles in playbooks to automatically execute the configurations needed to set up your instances. Datadog provides an Ansible role that playbooks can use to easily install the Agent on your EC2 instances. To install the role, run the following command on your host machine:

ansible-galaxy install Datadog.datadog

This will install the necessary role files in .ansible/roles of your home directory. Once installed, you can add the Datadog Agent role to your playbook and automatically install the Agent on all matching instances pulled from your dynamic inventory.

Create an Ansible dynamic inventory file

Inventory files can either be static or dynamic. A static inventory file is an INI- or YAML- formatted list of hosts, groups, and variables, while a dynamic inventory file may simply list a region (e.g., us-east-2) to pull hosts from. A dynamic inventory will query the AWS API to get the most up-to-date list of virtual machines every time you run the playbook, which is particularly useful for environments that automatically scale up and down to reflect real-time traffic. Though we are focusing on dynamic inventory in this guide, you can read more about configuring static inventory in the Ansible documentation.

By default, the Ansible binary looks for an inventory file called hosts, located in the /etc/ansible directory. This file can also be created as a subdirectory, so that you can store multiple inventory files for Ansible to concatenate into a full inventory. This gives you the flexibility to create multiple dynamic or static files for your environment.

You can also create new subdirectories in your inventory location group and categorize your configuration files (e.g., server type, region, environment). If you need to specify which inventory to use, you can override where Ansible looks for the default inventory via the command line or by editing your Ansible configuration file.

In the /etc/ansible/hosts/ directory, create a new dynamic inventory file. You can name the file anything you would like, but it does need to end with aws_ec2.yaml in order for it to be associated with the AWS dynamic inventory plugin:

plugin: aws_ec2

regions:

- YOUR_REGION

- YOUR_REGION

keyed_groups:

# Add hosts to tag_Name_Value groups for each Name/Value tag pair

- prefix: tag

key: tags

aws_access_key_id: YOUR_ACCESS_KEY

aws_secret_access_key: YOUR_SECRET_KEY

The sample configuration above uses Ansible’s built-in AWS EC2 inventory plugin and includes a few basic parameters for connecting to the AWS API. Make sure to replace the regions, aws_access_key_id, and aws_secret_access_key parameter values with your AWS region(s) (e.g., us-east-2) and keys. Ansible will use this inventory file to pull all available hosts in the region(s) you specify, apply any filtering options, and automatically group them by their tags based on the keyed_groups parameter.

Create the Ansible playbook

You can create an Ansible playbook that utilizes your dynamic inventory and Datadog Agent role. Playbooks can be stored and organized anywhere you would like on your Ansible host, but Ansible also provides some best practices for organizing complex projects with multiple playbooks and inventories.

Create a new datadog_playbook.yaml file and include the following configuration:

- name: Install Datadog Agent on servers in AWS

hosts: tag_datadog_yes

become: yes

user: centos #Use the default login for the AWS image. Here we are using a Centos image.

roles:

- { role: Datadog.datadog, become: yes }

vars:

datadog_api_key: YOUR_API_KEY

datadog_config:

tags:

- env:dev

logs_enabled: true

process_config:

enabled: "true"

The name parameter describes the playbook’s function; you can customize it however you like. Let’s walk through each section of this playbook.

The hosts parameter determines where Ansible will install the Datadog Agent. This example snippet instructs Ansible to install the Agent on any EC2 resource tagged with datadog:yes in Amazon’s EC2 console. You can replace datadog_yes with any <KEY>_<VALUE> pair that applies to your EC2 hosts.

become: yes

user: centos #Use the default login for the AWS image. Here we are using a Centos image.

roles:

- { role: Datadog.datadog, become: yes }

The snippet above instructs Ansible to log in to your EC2 instance(s) as the centos user and elevate to “sudo” privileges (required for package installs and service reboots) with become: yes. Make sure to modify the user value to match the default user for your EC2 instance’s AMI. The roles parameter instructs Ansible to use the Datadog Agent role we installed earlier, which will install the Agent on your hosts.

datadog_api_key: YOUR_API_KEY

As seen in the example above, you will need to include your Datadog API key, which you can find in your account’s API settings.

datadog_config:

tags:

- env:dev

logs_enabled: true

process_config:

enabled: "true"

Finally, the datadog_config section specifies how to configure the Datadog Agent after it gets installed on each of your EC2 instances. With this example configuration, Ansible will apply a global env:dev tag to your Datadog configuration, enable log collection, and enable the Process Agent for each available instance pulled from your dynamic inventory. You can add any global tags (e.g., role, env, team) to your configuration to help you easily search for your EC2 hosts in Datadog.

You can also configure other Datadog integrations on your EC2 instances with the datadog_checks variable, giving you a seamless installation process for your resources.

Test and apply your configurations

Now that you’ve configured your dynamic inventory and playbook, you should test the inventory configuration by running the ansible-inventory command on your Ansible host:

ansible-inventory --graph

This command queries all of the known inventory files and outputs a formatted graph of your inventory. If the configuration is correct, you will see a list of available EC2 hosts, grouped by your tags:

@all:

|--@tag_datadog_yes:

| |-- c2-12-345-678-901.compute-1.amazonaws.com

| |-- c3-98-765-432-101.compute-1.amazonaws.com

| |-- c2-23-123-435-432.compute-1.amazonaws.com

In the example above, Ansible automatically pulled an EC2 instance that matched the tagging group (datadog:yes) and the region defined in the dynamic inventory configured earlier (us-east-2). With the inventory correctly reporting, you can now run the playbook with the ansible-playbook command on your Ansible host:

ansible-playbook datadog_playbook.yaml

This command will instruct Ansible to install and automatically configure the Datadog Agent on all of the EC2 instances pulled from the sample_aws_ec2.yaml dynamic inventory file you created earlier.

View your instances and Ansible deployments in Datadog

By installing the Agent on your hosts, you can immediately begin monitoring system-level metrics with Datadog’s built-in host dashboards and configure one of Datadog’s 1,000 integrations.

Built-in system dashboard for monitoring your hosts

If you’ve enabled the AWS integration, you’ll also be able to monitor CloudWatch-based EC2 metrics with Datadog’s out-of-the-box integration dashboard.

Built-in EC2 integration dashboard

You can also monitor your Ansible deployments with Datadog’s callback plugin, which enables you to get real-time reports on Ansible runs and quickly identify failed deployments.

Integration dashboard for monitoring Ansible deployments

Check out our documentation for more information about setting up Datadog’s Ansible integration. Once configured, the Agent will automatically forward Ansible data to your Datadog account so you can immediately see the status of all of your deployments.

Start monitoring your dynamic infrastructure with Datadog and Ansible

Ansible enables you to create a repeatable process for installing and configuring the Datadog Agent on your dynamic inventories (e.g., groups of EC2 instances), so you can quickly monitor new resources with Datadog. If you are already using Datadog, you can start using Ansible to automatically configure the Datadog Agent to monitor any services running on the hosts in your dynamic inventories. If you’re new to Datadog, sign up for a 14-day free trial to start monitoring your Ansible deployments and EC2 instances.