Puppet Class: alerts::deploy::prometheus

Defined in:
modules/alerts/manifests/deploy/prometheus.pp

Overview

Parameters:

  • deploy_dir (Stdlib::Unixpath) (defaults to: '/srv/alerts')
  • git_dir (Stdlib::Unixpath) (defaults to: '/srv/alerts.git')
  • instances (Array[String]) (defaults to: [])


3
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
# File 'modules/alerts/manifests/deploy/prometheus.pp', line 3

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 instance-specific alerts
    $instances.each |$instance| {
        alerts::deploy::instance { $instance:
            alerts_dir => $git_dir,
            deploy_dir => "${deploy_dir}/${instance}",
            deploy_tag => $instance,
        }
    }

    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,
    }
}