ansible-role-cloudwatch-logs-agent

Ansible Role for AWS CloudWatch Logs agent

Build Status

Introduction

An Ansible role to install AWS Cloudwatch Logs agent on CentOS.

In case you can't afford to run Amazon Linux, this role will install the cloudwatch agent on centos.

Current status :

  • CentOS 7 --> Tested.
  • CentOS 6 --> Not tested (Contributor welcome !)

Please see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html

Prerequisites

AMI

This role assumes you run an AMI provide by CentOS on AWS market place (free of charge).

To find the latest AMI from Centos for your AWS region you can run the command below.

aws --region eu-west-1 ec2 describe-images \
    --owners aws-marketplace \
    --filters Name=product-code,Values=aw0evgkw8e5c1q413zgy5pjce \
    --query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
    --output 'text'

Monitoring scripts for linux

We also install the monitoring script for linux to monitor memory, cpu, swap, etc. You need to have a role attach to the instance (or credentials) in order to be able to write to cloudwatch.

See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html

Usage

Include the folder in your roles directory.

If you want to run this playbook locally you can do the following.

Clone the repository

git clone https://github.com/bitintheskud/ansible-role-cloudwatch-logs-agent.git

Create a local ansible playbook with the role included.

cat > playbook.yml
---
- name: Test cloudwatch role
  hosts: 127.0.0.1
  become: yes
  roles:
    - { role: '<YOUR PATH>/ansible-role-cloudwatch-logs-agent' }

Run ansible-playbook

ansible-playbook  -i "localhost," -c local playbook.yml

You need to attach a role to your instance to send message to AWS Cloudwatch.

see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html

What's next

  • Test redhat 7 distribution with this role.

License

MIT

About

An Ansible role to install AWS Cloudwatch Logs agent on CentOS 7

Install
ansible-galaxy install bitintheskud/ansible-role-cloudwatch-logs-agent
GitHub repository
License
Unknown
Downloads
45
Owner