Puppet Class: profile::prometheus::web

Defined in:
modules/profile/manifests/prometheus/web.pp

Overview

SPDX-License-Identifier: Apache-2.0



2
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
# File 'modules/profile/manifests/prometheus/web.pp', line 2

class profile::prometheus::web () {
    # Acts as a reverse proxy http -> https, hence 'mod_ssl' + http_only
    class { '::httpd':
        modules   => ['rewrite',
                      'proxy','proxy_http', 'proxy_balancer',
                      'lbmethod_byrequests', 'ssl'],
        http_only => true,
    }

    profile::auto_restarts::service { 'apache2': }
    profile::auto_restarts::service { 'envoyproxy': }

    firewall::service { 'prometheus-web':
        proto    => 'tcp',
        port     => [80],
        src_sets => ['DOMAIN_NETWORKS'],
    }

    prometheus::instances().each |$instance, $config| {
        # Configure reverse proxy for prometheus instances belonging to this host or site
        $hosts_for_site = $config['hosts'].filter |$h| { $h =~ "\\.${::site}" }
        if $::fqdn in $config['hosts'] or !empty($hosts_for_site) {
            prometheus::web { $instance:
                proxy_pass => prometheus::proxy_pass($config),
            }
        }
    }
}