4
5
6
7
8
9
10
11
12
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
|
# File 'manifests/service.pp', line 4
class grafana::service {
case $grafana::install_method {
'docker': {
$container = {
'grafana' => $grafana::container_params,
}
$defaults = {
image => "${grafana::docker_image}:${grafana::version}",
ports => $grafana::docker_ports,
}
create_resources(docker::run, $container, $defaults)
}
'package','repo': {
service { 'grafana':
ensure => running,
name => $grafana::service_name,
enable => true,
subscribe => Package['grafana'],
}
}
'archive': {
$service_path = "${grafana::install_dir}/bin/${grafana::service_name}"
$service_config = "${grafana::install_dir}/conf/custom.ini"
if !defined(Service['grafana']) {
service { 'grafana':
ensure => running,
name => $grafana::service_name,
provider => base,
binary => "su - grafana -c '${service_path} -config=${service_config} -homepath=${grafana::install_dir} web &'",
hasrestart => false,
hasstatus => false,
status => "ps -ef | grep ${grafana::service_name} | grep -v grep",
}
}
}
default: {
fail("Installation method ${grafana::install_method} not supported")
}
}
}
|