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
73
74
75
76
77
78
79
80
81
82
83
|
# File 'manifests/server.pp', line 18
class loki::server (
String $hostname,
String $grafana_password,
String $promtail_password,
String $aws_access_key_id,
String $aws_secret_access_key,
String $email,
Hash[String, String] $users = {},
Boolean $retention_enabled = false,
String $retention_period = '91d',
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,
Optional[Array[String]] $backup_args = undef
) {
include loki
package { ['loki', 'logcli']: }
-> file { ['/var/lib/loki', '/var/lib/loki/index', '/var/lib/loki/chunks', '/var/lib/loki/wal']:
ensure => directory,
owner => 'loki',
}
-> file { '/etc/systemd/system/loki.service':
ensure => file,
source => 'puppet:///modules/loki/loki.service',
}
-> file { '/etc/loki/loki.yaml':
ensure => file,
content => template('loki/loki.yaml.erb'),
}
~> service { 'loki':
ensure => running,
enable => true,
}
$merged_users = $users + {
'grafana' => $grafana_password,
'promtail' => $promtail_password,
}
nginx::site { $hostname:
proxy_target => 'http://localhost:3100',
aws_access_key_id => $aws_access_key_id,
aws_secret_access_key => $aws_secret_access_key,
email => $email,
users => $merged_users,
}
if $backup_target != '' {
backup::repo { 'loki':
source => '/var/lib/loki',
target => $backup_target,
watchdog_url => $backup_watchdog,
password => $backup_password,
environment => $backup_environment,
rclone_config => $backup_rclone,
args => $backup_args,
}
}
}
|