Giter VIP home page Giter VIP logo

ansible-role-telegraf's Introduction

#######################################################################################################

❗ DEPRECATION ❗

This repository and the role associated are deprecated in favor of the Manala Ansible Collection

You will find informations on its usage on the collection repository

#######################################################################################################

Ansible Role: Telegraf Build Status

Report issues and send Pull Requests in the main Ansible Role repository

This role will deal with the setup and the config of influxdata Telegraf.

It's part of the Manala Ansible stack but can be used as a stand alone component.

Requirements

This role is made to work with the telegraf official debian packages, available on the influxdata debian repository. Please use the manala.apt role to handle it properly.

manala_apt_preferences:
  - telegraf@influxdata

Installation

Ansible 2+

Using ansible galaxy cli:

ansible-galaxy install manala.telegraf

Using ansible galaxy requirements file:

- src: manala.telegraf

Role Handlers

Name Type Description
telegraf restart Service Restart telegraf agent

Role Variables

Name Default Type Description
manala_telegraf_install_packages ~ String Dependency packages to install
manala_telegraf_install_packages_default ['telegraf'] String Default dependency packages to install
manala_telegraf_config_template 'config/_default.j2' String Main configuration base template path
manala_telegraf_config ~ Array/String Main configuration directives
manala_telegraf_configs_exclusive false Array Additional configurations exclusivity
manala_telegraf_configs_dir '/etc/telegraf/telegraf.d' String Additional configurations directory path
manala_telegraf_configs_defaults {} Array Additional configurations defaults
manala_telegraf_configs [] Array Additional configurations directives

Configuration example

See https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md

Use telegraf default base config template (recommended):

manala_telegraf_config_template: config/telegraf/base/telegraf.conf.j2
manala_telegraf_config:
  global_tags:
    foo: bar
  agent:
    hostname: "{{ ansible_fqdn }}"

Start from a fresh empty main config, using dict parameters:

manala_telegraf_config:
  agent:
    hostname: "{{ ansible_fqdn }}"
    quiet: true
  outputs:
    file:
      - files: [/dev/null]
        ...

Use raw main config:

manala_telegraf_config: |
[agent]
  hostname = "{{ ansible_fqdn }}"
  quiet = true

[[outputs.file]]
  files = ["/dev/null"]
  ...

Use dict's array parameters (deprecated):

manala_telegraf_config:
  - agent:
    - hostname: "{{ ansible_fqdn }}"
    - quiet: true

Additionnal configurations:

manala_telegraf_configs:
  # Config based
  - file: config.conf
    config:
      inputs:
        cpu:
          - percpu: true
            totalcpu: false
            tags:
              tag-1: foo
              tag-2: bar
            tagdrop:
              cpu: [cpu6, cpu7]
  # Content based
  - file: content.conf
    config: |
      [[inputs.cpu]]
        percpu = true
        totalcpu = false

        [inputs.cpu.tags]
          tag-1 = "foo"
          tag-2 = "bar"

        [inputs.cpu.tagdrop]
          cpu = ["cpu6", "cpu7"]
  # Template based (file name based on template)
  - template: telegraf/bar.conf.j2
    config:
      foo: bar
  # Template based (force file name)
  - file: baz.conf
    template: telegraf/bar.conf.j2
    config:
      foo: bar
  # Dicts array template based (deprecated)
  - file: template_deprecated.conf
    template: configs/input_cpu.conf.j2
    config:
      - percpu: true
      - totalcpu: false
      - tags:
        - tag-1: foo
        - tag-2: bar
      - tagdrop:
        - cpu: [cpu6, cpu7]
  # Ensure config is absent
  - file: absent.conf
    state: absent # "present" by default
  # Ignore config
  - file: ignore.conf
    state: ignore
  # Flatten configs
  - "{{ my_custom_configs_array }}"

manala_telegraf_configs_exclusive allow you to clean up existing telegraf configuration files into directory defined by the manala_telegraf_configs_dir key. Made to be sure no old or manually created files will alter current configuration.

manala_telegraf_configs_exclusive: true

Example playbook

- hosts: all
  roles:
    - role: manala.telegraf

Licence

MIT

Author information

Manala (http://www.manala.io/)

ansible-role-telegraf's People

Contributors

greedybro avatar nervo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

bsmeding

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.