frank6866.influxdb

InfluxDB

This role is used to deploy InfluxDB. Support features as foolows:

  • deploy InfluxDB with no https or authentication by default
  • enable https
  • enable authentication

Prepare

Assuming we have our private CA, we generating key and certificate file by the following commands:

➜ mkdir /tmp/process_csr/influxdb/
➜ openssl genrsa -out /tmp/process_csr/influxdb/influxdb.key 2048
➜ openssl req -new -batch -days 3650 -subj /CN=influxdb -key /tmp/process_csr/influxdb/influxdb.key -reqexts SAN -config <(cat /usr/local/etc/openssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=IP:192.168.168.201,IP:192.168.168.202,IP:192.168.168.203,DNS:localhost")) -out /tmp/process_csr/influxdb/influxdb.csr
➜ openssl ca -in /tmp/process_csr/influxdb/influxdb.csr  -extensions SAN -config <(cat /usr/local/etc/openssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=IP:192.168.168.201,IP:192.168.168.202,IP:192.168.168.203, DNS:localhost"))  -out /tmp/process_csr/influxdb/influxdb.crt

inventory file example

# Generated by Vagrant

vagrant1 ansible_ssh_host=192.168.168.201 ansible_ssh_port=2222 ansible_ssh_user='vagrant'

[influxdb]
vagrant1

[influxdb:vars]
influxdb_data_dir=/var/lib/influxdb/data
influxdb_wal_dir=/var/lib/influxdb/wal

influxdb_https_enabled="true"
influxdb_cert_file_path=/tmp/process_csr/influxdb/influxdb.crt
influxdb_key_file_path=/tmp/process_csr/influxdb/influxdb.key
influxdb_cacert_file_path=/usr/local/etc/openssl/myCA/cacert.pem

influxdb_auth_enabled="true"

Role Variables

By default, this role does not enable https, if you want to enable https, you should set influxdb_https_enabled variable to "true", and set the following variable:

influxdb_cert_file_path=/tmp/process_csr/influxdb/influxdb.crt
influxdb_key_file_path=/tmp/process_csr/influxdb/influxdb.key
influxdb_cacert_file_path=/usr/local/etc/openssl/myCA/cacert.pem

Notice that the cert releated files' path is local path, aka, on you computer, not on the server.

The auth of InlfuxDB is not enalbed by default, you can set influxdb_auth_enabled to "true" to enable authentication in InfluxDB:

influxdb_auth_enabled="true"

create user:

# influx
> CREATE USER admin WITH PASSWORD 'change_me' WITH ALL PRIVILEGES
> auth

Example Playbook

- hosts: influxdb
  become: true
  roles:
    - frank6866.influxdb

License

MIT

Install
ansible-galaxy install frank6866.influxdb
GitHub repository
License
Unknown
Downloads
81
Owner