Puppet Class: influxdb
- Defined in:
- manifests/init.pp
Summary
Configure InfluxDB instanceOverview
[View source]
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'manifests/init.pp', line 13
class influxdb (
String $hostname,
String $datadir,
String $tls_account,
Optional[String] $tls_challengealias = undef,
String $container_ip = '172.17.0.2',
Optional[String] $backup_target = undef,
Optional[String] $backup_watchdog = undef,
Optional[String] $backup_password = undef,
Optional[Hash[String, String]] $backup_environment = undef,
Optional[String] $backup_rclone = undef,
) {
file { [$datadir, "${datadir}/data", "${datadir}/certs"]:
ensure => directory,
}
-> file { "${datadir}/config.yml":
ensure => file,
content => template('influxdb/config.yml.erb'),
}
-> acme::certificate { $hostname:
reloadcmd => '/usr/bin/systemctl restart container@influxdb',
keypath => "${datadir}/certs/key",
fullchainpath => "${datadir}/certs/cert",
account => $tls_account,
challengealias => $tls_challengealias,
}
-> firewall { '100 dnat for influxdb':
chain => 'DOCKER_EXPOSE',
jump => 'DNAT',
proto => 'tcp',
dport => 443,
todest => "${container_ip}:8086",
table => 'nat',
}
-> docker::container { 'influxdb':
image => 'influxdb:latest',
args => [
"--ip ${container_ip}",
"-v ${datadir}/data:/var/lib/influxdb2",
"-v ${datadir}/config.yml:/etc/influxdb2/config.yml",
"-v ${datadir}/certs:/mnt/certs",
],
cmd => '',
}
if $backup_target != '' {
backup::repo { 'influxdb':
source => "${datadir}/data",
target => $backup_target,
watchdog_url => $backup_watchdog,
password => $backup_password,
environment => $backup_environment,
rclone_config => $backup_rclone,
}
}
}
|