buluma.influxdb2
Ansible Role influxdb2
This role helps you install and set up InfluxDB 2.0 using Ansible.
| GitHub | Version | Issues | Pull Requests | Downloads | 
|---|---|---|---|---|
Example Playbook
This example is from molecule/default/converge.yml and it's tested with every update made.
---
- name: Converge
  hosts: all
  gather_facts: true
  become: yes
  vars:
    apt_autostart_state: enabled
    pip_package: python3-pip
    pip_executable: "{{ 'pip3' if pip_package.startswith('python3') else 'pip' }}"
    pip_install_packages:
      - name: setuptools
      - name: requests
  pre_tasks:
    - name: Update apt cache.
      apt: update_cache=true cache_valid_time=600
      when: ansible_os_family == 'Debian'
    - name: Set package name for older OSes.
      ansible.builtin.set_fact:
        pip_package: python-pip
      when: >
        (ansible_os_family == 'RedHat') and (ansible_distribution_major_version | int < 8)
        or (ansible_distribution == 'Debian') and (ansible_distribution_major_version | int < 10)
        or (ansible_distribution == 'Ubuntu') and (ansible_distribution_major_version | int < 18)
  roles:
    - role: buluma.influxdb2
      influxdb_orgs:
        - name: main-org
          description: Main organization
        - name: guest-org
      influxdb_users:
        - name: admin01
          org: main-org
          password: secretPassword
        - name: guest01
          org: guest-org
          password: secretPassword
      influxdb_buckets:
        - name: bucket01
          description: First bucket
          org: main-org
          retention: 1d
        - name: bucket02
          org: main-org
Before running the playbook, the machine needs to be set up. In Continuous Integration (CI), this is done using molecule/default/prepare.yml:
---
- name: Prepare container
  hosts: all
  gather_facts: true
  become: yes
  serial: 30%
  vars:
    apt_autostart_state: enabled
  roles:
    - role: buluma.bootstrap
    - role: buluma.apt_autostart
    - role: buluma.pip
    - name: buluma.influxdb2
  post_tasks:
    - name: Create /environmentfile.txt
      ansible.builtin.copy:
        content: "value=influxdb"
        dest: /environmentfile.txt
        mode: "0644"
For a complete guide on how to use these roles, see this full explanation.
Role Variables
Default values for variables can be found in defaults/main.yml:
---
influxdb_dependencies:
  - apt-transport-https
  - curl
  - gnupg
influxdb_packages:
  - influxdb2
  - influxdb2-cli
influxdb_package_state: present
influxdb_config_path: /etc/influxdb
influxdb_bolt_path: /var/lib/influxdb/influxd.bolt
influxdb_engine_path: /var/lib/influxdb/engine
influxdb_host: http://localhost:8086
influxdb_config: {}
#  http-bind-address: 0.0.0.0:8086
#  reporting-disabled: true
influxdb_primary_org: example-org
influxdb_primary_bucket: example-bucket
influxdb_primary_username: example-user
influxdb_primary_password: ExAmPl3PA55W0rD
# Set your root token for admin user
influxdb_admin_token: EXAMPLE-TOKEN
influxdb_orgs: []
#  - name: main-org
#    description: Main organization
#  - name: guest-org
influxdb_users: []
#  - name: admin01
#    org: main-org
#    password: secretPassword
#  - name: guest01
#    org: guest-org
#    password: secretPassword
influxdb_buckets: []
#  - name: bucket01
#    description: First bucket
#    org: main-org
#    retention: 1d
#  - name: bucket02
#    description: Second bucket
#    org: main-org
influxdb_service_enabled: true
influxdb_service_state: started
influxdb_skip_onboarding: false
Requirements
- Python packages listed in requirements.txt.
State of Used Roles
These roles help prepare your system. You can set up your system in other ways too.
| Requirement | GitHub | Version | 
|---|---|---|
| buluma.bootstrap | ||
| buluma.apt_autostart | ||
| buluma.pip | 
Context
This role is part of a collection of compatible roles. For more information, check the documentation for these roles here.
Here is an overview of related roles:

Compatibility
This role has been tested on the following container images:
| Container | Tags | 
|---|---|
| Debian | all | 
| Ubuntu | all | 
| Kali | all | 
The minimum required version of Ansible is 2.12. Tests have also been conducted on:
- Previous versions.
- Current version.
- Development version.
If you find any issues, please report them on GitHub.
Changelog
See the Role History.
License
This role is licensed under MIT.
Author Information
Created by Shadow Walker.
Install and configure InfluxDB 2.0 using Ansible.
ansible-galaxy install buluma.influxdb2