July 2017
Intermediate to advanced
402 pages
9h 38m
English
To send our logs to CloudWatch, AWS provides a daemon called awslogs. We are going to install and configure it through Ansible.
Go into your ansible roles directory:
$ cd ansible/roles
Create a new role called awslogs:
$ ansible-galaxy init awslogs - awslogs was created successfully
We will first edit the task file awslogs/tasks/main.yml. Our first operation will be to install the package. For that, we will use the yum module:
---
# tasks file for awslogs
- name: install awslogs
yum:
name: awslogs
state: present
We will want to configure the service dynamically with Ansible. For that, we will want to create a handler to restart awslogs when the configuration changes.
Edit the file awslogs/handlers/main.yml ...
Read now
Unlock full access