Git Product home page Git Product logo

ansible-role-awslogs-setup's Introduction

awslogs-setup

Set up the AWS CloudWatch Logs Agent from scratch.

Unlike similar roles, this does not call the awslogs-agent-setup.py script. Instead, that script has been decomposed into a set of files, templates and ansible tasks which can be run to achieve the same (non-interactive) results.

This allows us to clearly separate the agent setup from the agent configuration. The latter will be very specific to your system and should probably be handled by a separate role that has awslogs-setup as a dependency (see below).

A copy of the original awslogs-agent-setup.py script is provided in the /src directory for reference.

Requirements

For use with EC2 Linux instances running on AWS.

Role Variables

You will probably need to set the AWS region that will be used by the installed aws-cli. This defaults to:

awslogs_setup_region: ap-southeast-2

The setup installs an agent daemon "nanny" script that tries to ensure that the agent is always running. This requires a couple of paths to system commands to be specified. The following defaults should work on most modern systems:

awslogs_setup_nanny_ps:      /usr/bin/ps
awslogs_setup_nanny_cat:     /usr/bin/cat
awslogs_setup_nanny_grep:    /usr/bin/grep
awslogs_setup_nanny_service: /usr/sbin/service

If you have quirky (or old) system, however, these can be overridden.

Example Playbook

This role only sets up the awslogs agent. The agent configuration is left up to you. This is very simple, but can be very specific to your system.

- hosts: servers
  vars:
    awslogs_setup_region: us-east-1   # or set via inventory

  roles:
    - tartansandal.awslogs-setup

  handlers:
    - name: restart awslogs
      service: awslogs state=restarted

  post_tasks:
    - name: configure awslogs for system log files
      template:
        src: awslogs.conf.j2
        dest: /var/awslogs/etc/awslogs.conf
      notify: restart awslogs

    # use the /var/awslogs/etc/config/ directory for service specific configs
    - name: configure awslogs for nginx log files
      template:
        src: nginx-awslogs.conf.j2
        dest: /var/awslogs/etc/config/nginx.conf
      notify: restart awslogs

The post_tasks shown above could be factored out into separate roles that have awslogs-setup as a dependency.

See http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/AgentReference.html for details on configuring the agent

ToDo

  1. Create a systemd configuration to manage the launcher script.

License

BSD

ansible-role-awslogs-setup's People

Contributors

kahlil-hodgson avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.