mkayontour.influxdb

Ansible InfluxDB

This role helps you install and set up InfluxDB, including managing databases and users. It should work with most major distributions. Feel free to submit Pull Requests or report Issues!

Requirements

Before using this role, you need to ensure two things:

  1. The influxdb Python client should be installed; this role will handle that.
  2. pip must be installed to set up the influxdb Python client.

Role Variables

Default Variables

The default variables are listed below. Each section of the influxdb.conf file has its own variable.

Make sure to change the admin password to something more secure than the default:

influxdb_admin_username: admin
influxdb_admin_password: admin

Example Configuration

Here’s the default configuration setup:

---
influxdb_manage_repository: yes
influxdb_manage_package: yes
influxdb_config_dir: /etc/influxdb
influxdb_config_global:
    reporting-disabled: false
    bind-address: 127.0.0.1:8086
influxdb_config_graphite:
  - enabled: false
    tags:
      - region=us
      - zone=test
influxdb_config_collectd:
  - enabled: false
influxdb_config_udp:
  - enabled: false
influxdb_config_meta:
  dir: /var/lib/influxdb/meta
  retention-autocreate: true
  logging-enabled: true
influxdb_config_http:
  enabled: true
  bind-address: :8086
  auth-enabled: true
  ping-auth-enabled: true
influxdb_config_data:
  dir: /var/lib/influxdb/data
  wal-dir: /var/lib/influxdb/wal
  series-id-set-cache-size: 100
influxdb_admin_username: admin
influxdb_admin_password: admin

For details on each parameter, refer to the official documentation:

You can define multiple entries for certain sections by using an array format, such as this example:

influxdb_config_graphite:
  - enabled: true
    database: graphite
    tags:
      - region=us
      - zone=test
      - instance=01
  - enabled: true
    database: graphite2
    tags:
      - region=de
      - zone=prod
      - instance=02

Define Databases

Use the following format to create multiple databases:

influxdb_databases:
  - name: telegraf-metrics
    state: present
  - name: graphite
    state: present
  - name: icinga
    state: present

Database parameters are as follows:

influxdb_databases:
  - name:
    login_password:
    login_username:
    hostname:
    port:
    proxies:
    retries:
    state:
    ssl:
    timeout:
    udp_port:
    use_udp:
    validate_certs:

Define Users

To create multiple users, use this syntax:

influxdb_users:
  - name: influxadm
    password: influxdbadmpass
    admin: yes
  - name: icinga
    admin: no
    password: icinga
    grants:
      - database: 'icinga'
        privilege: 'WRITE'

User parameters include:

influxdb_users:
  - name: foo
    admin: true/false
    state: present/absent
    password: 'password'
    port: 8086
    hostname: localhost
    login_username: admin
    login_password: admin
    ssl: true/false

Example Playbook

Here’s an example of how to use this role:

- hosts: influxdb-node1
  vars:
    influxdb_admin_username: admin
    influxdb_admin_password: admin123
    influxdb_databases:
      - name: telegraf-metrics
        state: present
    influxdb_users:
      - name: telegraf
        password: telegraf
        grants:
          - database: telegraf-metrics
            privilege: "WRITE"
  roles:
     - { role: mkayontour.influxdb }

License

Apache-2.0

Author Information

Twitter: @mkayontour

Informazioni sul progetto

Install and configures InfluDB on Rhel, Debian and Ubuntu

Installa
ansible-galaxy install mkayontour.influxdb
Licenza
apache-2.0
Download
23.3k
Proprietario
Twitter: @mkayontour