mediafellows.influxdb
Ansible InfluxDB Server Role
This role sets up a full TICK stack server (excluding Telegraf). It installs a complete setup of InfluxDB, Chronograf, and Kapacitor.
This role is designed for a server that collects metrics from the Telegraf agent, which are then stored in InfluxDB. It allows for monitoring and alerting using Chronograf and Kapacitor on the same server. Chronograf will be set up with GitHub OAuth to keep it secure from public access.
If you want to install Telegraf as well, there is a separate role available at mediafellows.telegraf that you can use for all the machines you want to monitor.
Requirements
You need Ubuntu 16.04 or newer as your operating system. Other Linux distributions may work, but they need to have the python-influxdb
package available in their repositories. This package is necessary for the Ansible InfluxDB modules to function.
If you are using Ansible version below 2.6, you might need to place the InfluxDB modules in your Ansible project library directory (usually ./library/
). You can find them at https://github.com/ansible/ansible/tree/devel/lib/ansible/modules/database/influxdb.
Also, make sure to open port 8888 to allow access to Chronograf. If you change the configuration or use a webserver (like a reverse proxy), adjust the port accordingly.
Role Variables
These are the variables you should customize:
chronograf_public_url: https://some-url.com
- The publicly accessible URL for your Chronograf setup.influxdb_admin_pw: secret_pw
- Set your own password for the InfluxDB admin user.influxdb_chronograf_pw: secret_pw
- Set your own password for the InfluxDB Chronograf user (for data reading).influxdb_telegraf_pw: secret_pw
- Set your own password for the InfluxDB Telegraf user (for data ingestion).influxdb_chronograf_oauth_secret: abc123def
- A random string used for encryption.influxdb_chronograf_oauth_github_id: abc123
- The OAuth app ID you get from GitHub after creating an app.influxdb_chronograf_oauth_github_secret: abc123
- The OAuth app secret provided by GitHub.influxdb_chronograf_oauth_github_org: myorg
- Limit access to your GitHub organization; make sure your OAuth app belongs to this organization.
You can also adjust additional parameters by checking defaults/main.yml
.
Some helpful variables for restoring from existing database backups:
influxdb_meta_backup: /some/path/to/influxdb_backup/meta.00
- Path to your InfluxDB metadata backup, which will be restored to the InfluxDB instance. This will overwrite existing database settings (users, tables, etc.).influxdb_chronograf_db_backup: /some/path/chronograf-v1.db
- Path to your Chronograf settings database file. This typically contains information like Influx sources and Chronograf authentication users.influxdb_kapacitor_db_backup: /some/path/kapacitor.db
- Path to your Kapacitor settings database file. This usually contains alert settings and TICK scripts.
Dependencies
This role does not depend on any other role.
Example Playbook
Here's an example of how to integrate the role into your playbook:
- hosts: servers
become: true
vars:
influxdb_port: 123
roles:
- mediafellows.influxdb
tasks:
# other tasks
License
BSD, as-is.
Author Information
Stefan Horning stefan.horning@mediafellows.com
Role to setting up a InfluxDB / TICK monitoring server
ansible-galaxy install mediafellows.influxdb