Defined Type: prometheus::ganeti

Defined in:
modules/prometheus/manifests/ganeti.pp

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • dest (String)
  • clusters (Array[String])
  • port (Stdlib::Port) (defaults to: 8080)
  • labels (Hash) (defaults to: {})


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'modules/prometheus/manifests/ganeti.pp', line 3

define prometheus::ganeti(
    String $dest,
    Array[String] $clusters,
    Stdlib::Port $port = 8080,
    Hash $labels = {},
) {
    if !$clusters.empty {
        $targets = $clusters.map |$target| { "${target}:${port}" }
        $data = {
            'targets' => $targets,
            'labels'  => $labels,
        }.flatten

        file { $dest:
            ensure  => stdlib::ensure(!$data.empty, 'file'),
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => "# This file is managed by puppet\n${data.to_yaml}\n"
        }
    }
}