Version information
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
- Puppet >= 4.10.0 < 7.0.0
- , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'mightp-influxdb', '1.0.3'
Learn more about managing modules with a PuppetfileDocumentation
Overview
This module will install and configure InfluxDB 1.x.
This module works on Debian- and RHEL-based OS'es.
Dependencies
This module depends on the toml gem, which has to be installed on the puppetmaster.
It can be installed via puppet, like this (using this module):
package { 'toml':
ensure => 'installed',
provider => 'puppetserver_gem',
}
Sample setup
class { '::influxdb':
admin_username => <admin username>,
admin_password => <admin password>,
configuration => {
'data' => {
'dir' => '/mnt/influxdb/data',
'wal-dir' => '/mnt/influxdb/wal',
'max-series-per-database' => 0,
'max-values-per-tag' => 0,
},
'[udp]' => {
'enabled' => true,
'bind-address' => ':8090',
'database' => 'metrics',
'batch-pending' => 1024,
'read-buffer' => 33554432,
},
},
databases => {
'prometheus' => {
'ensure' => present,
}
},
users => {
'grafana' => {
'password' => 'asdfghjkl!"§"!"$',
},
'prometheus' => {
'password' => 'asdfghjkl!"§"!"$',
},
},
}
influxdb::database { 'metrics': }
influxdb::user { 'grafana_user':
password => 'mySuperSecretPassWORD',
privilege => 'READ',
database => 'metrics',
}
# Note: for durations, InfluxDB converts the duration literals to something else. Write that something else in puppet.
influxdb::retention_policy { '1YearRetention':
database => 'prometheus',
duration => '8640h0m0s',
}
http auth
http_auth is automatically enabled and configured.
An admin account will automatically be created with the parameters passed to the main class: influxdb::admin_username
and influxdb::admin_password
This admin account is the one used in puppet, to manage all resources
Reference
Table of Contents
Classes
influxdb
: Main class that ties the module togetherinfluxdb::config
: Manages the configuration of InfluxDBinfluxdb::install
: Manages the installation of InfluxDBinfluxdb::service
: Manages the service of InfluxDB
Defined types
influxdb::database
: Manages a database within InfluxDBinfluxdb::retention_policy
: Manages a retention policy on a database, within InfluxDBinfluxdb::user
: Manages a user within InfluxDB
Resource types
influxdb_auth
: Setup http_auth in InfluxDB.influxdb_database
: Create or update a database in InfluxDB.influxdb_retention_policy
: Create or update a user in InfluxDB.influxdb_user
: Create or update a user in InfluxDB.
Classes
influxdb
Manages InfluxDB
Examples
class { '::influxdb':
admin_username => $admin_username,
admin_password => $admin_password,
}
class { '::influxdb':
admin_username => $admin_username,
admin_password => $admin_password,
configuration => {
'data' => {
'dir' => '/mnt/influxdb/data',
'wal-dir' => '/mnt/influxdb/wal',
'max-series-per-database' => 0,
'max-values-per-tag' => 0,
}
},
databases => {
'prometheus' => {
'ensure' => present,
},
},
users => {
'grafana' => {
'password' => 'asdfghjkl!"§"!"$',
},
'prometheus' => {
'password' => 'asdfghjkl!"§"!"$',
},
}
}
Parameters
The following parameters are available in the influxdb
class.
ensure
Data type: Enum['present','absent']
- Whether to create or destroy this resource
Default value: 'present'
ensure_package
Data type: Variant[String,Undef]
- Overwrite $ensure for the package only. Used if package needs to be anything but 'present' or 'absent'
Default value: undef
admin_password
Data type: String
- The password used for the main admin account
admin_username
Data type: String
- The username used for the main admin account
configuration
Data type: Hash
- The configuration to use. Default values will be provided for everything not written
Default value: {}
api_port
Data type: Integer
- The port which to connect to InfluxDB
Default value: 8086
config_path
Data type: String
- The path to the main configuration file
Default value: '/etc/influxdb/influxdb.conf'
group
Data type: String
- The group used for permission on for everything
Default value: 'influxdb'
owner
Data type: String
- The owner used for permission on for everything
Default value: 'influxdb'
databases
Data type: Hash[String, Hash[String, Any]]
- Create the provided databases. The hash is passed on to infludb::database
Default value: {}
users
Data type: Hash[String, Hash[String, Any]]
- Create the provided users. The hash is passed on to infludb::user via create_resources()
Default value: {}
influxdb::config
Manages the configuration of InfluxDB
Examples
Use main class
influxdb::install
Manages the installation of InfluxDB
Examples
Use main class
influxdb::service
Manages the service of InfluxDB
Examples
Use main class
Defined types
influxdb::database
Creates or destroys a database within InfluxDB
Examples
influxdb::database { 'my_database_name': }
Parameters
The following parameters are available in the influxdb::database
defined type.
ensure
Data type: Enum['present','absent']
- Create or destroy database
Default value: 'present'
name
- (namevar) The name of the database
admin_password
Data type: String
Default value: $influxdb::admin_password
admin_username
Data type: String
Default value: $influxdb::admin_username
influxdb::retention_policy
Creates or destroys a retention policy on a database, within InfluxDB
Examples
influxdb::retention_policy { '1YearRetention':
database => 'prometheus',
duration => '8640h0m0s',
}
Parameters
The following parameters are available in the influxdb::retention_policy
defined type.
ensure
Data type: Enum['present','absent']
- Create or destroy retention policies
Default value: 'present'
name
- (namevar) The name of the database
duration
Data type: String
- The duration in which to keep metrics, in duration literals (https://docs.influxdata.com/influxdb/v1.7/query_language/spec/#durations)
shard_duration
Data type: Optional[String]
- The duration in which to keep shards. Set to undef to let InfluxDB decide
Default value: undef
database
Data type: String
- Which database the policy should be applied too
replicas
Data type: Integer
- The amount of replicas to use (should be the same as the number of nodes)
Default value: 1
is_default
Data type: Boolean
- Wheter the policy is the default for the database
Default value: true
admin_password
Data type: String
Default value: $influxdb::admin_password
admin_username
Data type: String
Default value: $influxdb::admin_username
influxdb::user
Create, destroy or update a user within InfluxDB
Examples
influxdb::user { 'read_only_user':
password => 'mySuperSecretPassWORD',
privilege => 'READ',
database => 'my_database',
}
influxdb::user { 'admin2':
password => 'Admin?Need?Better&Password',
is_admin => true,
}
Parameters
The following parameters are available in the influxdb::user
defined type.
privilege
Data type: Variant[Enum['READ', 'WRITE', 'ALL'],Undef]
- What privileges to give the user
Default value: undef
is_admin
Data type: Boolean
- Whether the user should be created as an admin or not
Default value: false
ensure
Data type: Enum['present','absent']
- Create or destroy user
Default value: 'present'
database
Data type: Variant[String,Undef]
- What database the user should have $privileges too (only for non-admins)
Default value: undef
password
Data type: Variant[String,Undef]
- The plain-text password to give the user
Default value: undef
name
- (namevar) The username of the user
admin_password
Data type: String
Default value: $influxdb::admin_password
admin_username
Data type: String
Default value: $influxdb::admin_username
Resource types
influxdb_auth
Setup http_auth in InfluxDB.
Properties
The following properties are available in the influxdb_auth
type.
ensure
Valid values: present, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the influxdb_auth
type.
name
namevar
A unique name for the resource
admin_username
Admin username to manage the resource with
admin_password
Admin password to manage the resource with
config_path
Path to the main config file
influxdb_database
Create or update a database in InfluxDB.
Properties
The following properties are available in the influxdb_database
type.
ensure
Valid values: present, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the influxdb_database
type.
name
namevar
A unique name for the resource
admin_username
Admin username to manage the resource with
admin_password
Admin password to manage the resource with
database
The database to create
influxdb_retention_policy
Create or update a user in InfluxDB.
Properties
The following properties are available in the influxdb_retention_policy
type.
ensure
Valid values: present, absent
The basic property that the resource should be in.
Default value: present
duration
The duration to keep data for
shard_duration
The duration to keep shards for
replicas
The amount of replicas to use
is_default
Whether or not this policy is the default for the database
Parameters
The following parameters are available in the influxdb_retention_policy
type.
name
namevar
A unique name for the resource
admin_username
Admin username to manage the resource with
admin_password
Admin password to manage the resource with
retention_policy
The retention policy to create
database
The database the retention policy should be applied to
influxdb_user
Create or update a user in InfluxDB.
Properties
The following properties are available in the influxdb_user
type.
ensure
Valid values: present, absent
The basic property that the resource should be in.
Default value: present
privilege
Which privilege to use
Parameters
The following parameters are available in the influxdb_user
type.
name
namevar
A unique name for the resource
admin_username
Admin username to manage the resource with
admin_password
Admin password to manage the resource with
username
The user to create
password
Password for the user to create
is_admin
Whether to user is a admin or normal user
database
Which database to grant access to
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[1.0.3] - 2020-02-18
Added
- added retention policy support.
[1.0.2] - 2020-02-17
Added
- added $users parameter to ::influxdb @unki.
- added $databases parameter to ::influxdb @unki.
- README: fix influxdb::user privilege-parameter @unki.
Changed
- adapt reading privileges from InfluxDB grants in case of ALL-PRIVILEGES @unki.
Dependencies
- camptocamp/systemd (>= 2.0.0)
- puppetlabs/apt (>= 7.0.0)
- puppetlabs/stdlib (>= 5.0.0)
- puppet/healthcheck (>= 1.0.0)