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
|
# File 'modules/alerts/manifests/deploy/prometheus.pp', line 4
class alerts::deploy::prometheus(
Stdlib::Unixpath $deploy_dir = '/srv/alerts',
Stdlib::Unixpath $git_dir = '/srv/alerts.git',
Array[String] $instances = [],
) {
require ::alerts
alerts::deploy::instance { 'local':
alerts_dir => $git_dir,
deploy_dir => $deploy_dir,
deploy_site => $::site,
}
# Deploy instance-specific alerts
$instances.each |$instance| {
alerts::deploy::instance { $instance:
alerts_dir => $git_dir,
deploy_dir => "${deploy_dir}/${instance}",
deploy_tag => $instance,
deploy_site => $::site,
}
}
git::clone { 'operations/alerts':
ensure => latest,
directory => $git_dir,
branch => 'master',
notify => Exec['start alerts-deploy'],
}
exec { 'start alerts-deploy':
command => '/bin/systemctl start alerts-deploy.target',
refreshonly => true,
notify => Exec['reload all prometheus instances'],
}
exec { 'reload all prometheus instances':
command => '/bin/systemctl reload prometheus@*',
refreshonly => true,
}
}
|