Skip to content

jasonwalsh/ansible-role-telegraf

Repository files navigation

CircleCI Ansible Quality Score Ansible Role

Ansible role for installing Telegraf

Contents

Introduction

This repository contains an Ansible role for installing and configuring Telegraf, an open source server agent to help collect metrics from stacks, sensors, and systems.

While similar roles exist, the purpose of this role is to be compatible with various platforms and architectures. Telegraf is cross-compiled and tested for different platforms.

Refer to the Platforms section of the README to view a table of platforms and architectures supported by this role.

Install

This role is installable via Ansible Galaxy or git:

$ ansible-galaxy install jasonwalsh.telegraf

$ git clone git@github.com:jasonwalsh/ansible-role-telegraf.git roles/telegraf

Usage

After installing the role, include it in an Ansible playbook:

---

- hosts: all
  roles:
    - jasonwalsh.telegraf

Custom Telegraf Configuration

By default, this role uses the Telegraf configuration defined in the official repository and exists in the files subdirectory.

To use a custom configuration file, create a telegraf_conf variable with the absolute or relative path to the configuration file.

---

# roles/x/vars/main.yml

telegraf_conf: ~/telegraf.conf

Platforms

Distribution Architectures
CentOS 7 x86_64
Ubuntu 14.04 x86_64
Ubuntu 16.04 x86_64

Testing

This repository uses Ansible Molecule for testing the role. To install Molecule via pip, invoke the following command:

$ pip install molecule

After installing Molecule, invoke the following command to run the entire test suite:

$ molecule test

License

MIT License