Getting started

debops.influxdb role is only the "client" part. To have a working InfluxDB installation, you also need to setup the debops.influxdb_server role somewhere. It can be either on the same host, or on a separate host. See the debops.influxdb_server documentation to learn how to install the database server itself.

Local database server

If the database server is installed locally, it will be automatically detected and used by the debops.influxdb role without any additional configuration. Also, if a remote server was used previously, and a local one was installed, it will automatically override the remote configuration. You might need to recreate the databases and user accounts in that case.

Remote database server

If your InfluxDB server is configured on a remote host and you don't have a local installation, debops.influxdb will detect that and won't manage the databases/user accounts without a server specified. To point it to a server, you need to set a variable in the inventory:

influxdb__server: 'influxdb.example.org'

This needs to be a FQDN address of a host with InfluxDB server installed. DNS name is required because this access is via a HTTP(S) API. Currently only 1 server at a time is supported by the role.

If debops.pki role is used to configure a PKI environment, with default domain PKI realm enabled, debops.influxdb_server role will configure the provided private keys and X.509 certificates to enable TLS connections to the database by default.

If the PKI environment is not configured or disabled, connections to the database server will be performed in cleartext, so you might want to consider securing them by configuring server on a separate internal network, or accessing it over a VPN connection. You can use debops.subnetwork, debops.tinc and debops.dnsmasq Ansible roles to set up a VPN internal network to secure communication between hosts.

Example inventory

To enable InfluxDB client support on a host, you need to add that host to [debops_service_influxdb] Ansible group:

[debops_service_influxdb]
hostname

When InfluxDB server is properly configured, or installed locally, you can create user accounts and databases using inventory variables:

influxdb__databases:

  - name: 'application_production'

influxdb__users:

  - name: 'application'
    grants:
       - database: 'application_production'
         privilege: 'ALL'

Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.influxdb role:

---

- name: Manage InfluxDB client
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_influxdb' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'

  roles:

    - role: python
      tags: [ 'role::python', 'skip::python', 'role::influxdb' ]
      python__dependent_packages3:
        - '{{ influxdb__python__dependent_packages3 }}'
      python__dependent_packages2:
        - '{{ influxdb__python__dependent_packages2 }}'

    - role: influxdb
      tags: [ 'role::influxdb', 'skip::influxdb' ]

Ansible tags

You can use Ansible --tags or --skip-tags parameters to limit what tasks are performed during Ansible run. This can be used after a host was first configured to speed up playbook execution, when you are sure that most of the configuration is already in the desired state.

Available role tags:

role::influxdb

Main role tag, should be used in the playbook to execute all of the role tasks as well as role dependencies.