README.md

Ansible Role: AWS CloudWatch Agent

This Ansible role installs and configures AWS CloudWatch Agent on AWS EC2 instances
and on-premise servers.

Requirements

An AWS EC2 instance or an on-premise Linux server

If using AWS EC2 instance, the instance must have an IAM role attached that has policies to run AWS CloudWatch Agent. Consider using the AWS provided policy - CloudWatchAgentServerPolicy.

If using on-premise server, configure /root/.aws/credentials and /root/.aws/config.

Create the file aws-cw-config.json in a path where Ansible can find it. Within this file, save your AWS CloudWatchAgent configuration in JSON format.

Role Variables

Variable

Default Value

Description

Required?

aws_cloudwatch_agent_username

The administrative user that should be the owner of the downloaded files. Typically same as remote_user. On Ubuntu it maybe ubuntu and CentOS it may be centos and on Amazon Linux it may be ec2-user. The role guesses the username based on OS if not set explicitly.

No

aws_cloudwatch_agent_download_directory

The location where the AWS CloudWatch Agent software has to be downloaded to. The role guesses the location based on OS if not set explicitly.

No

aws_cloudwatch_agent_download_url

The URL from which Amazon CloudWatchAgent must be downloaded. This is automatically set by the role. But you can override it.

Example Playbook

- hosts: cloudwatch-serversroles:
- role: Gavika.aws-cloudwatch-agent

Continuous Integration

This Github project uses TravisCI for continuous integration. AWS secrets are
used in the Travis environment file. Therefore, CI builds are not available for
pull requests. However, you can run molecule tests locally.