Puppet Class: profile::prometheus::openstack_exporter

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

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • listen_port (Stdlib::Port) (defaults to: lookup('profile::prometheus::openstack_exporter::listen_port', {default_value => 12345}))
  • cloud (String[1]) (defaults to: lookup('profile::prometheus::openstack_exporter::cloud', {default_value => 'eqiad1'}))
  • ensure (Wmflib::Ensure) (defaults to: lookup('profile::prometheus::openstack_exporter::ensure', {default_value => 'present'}))


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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'modules/profile/manifests/prometheus/openstack_exporter.pp', line 2

class profile::prometheus::openstack_exporter (
    Stdlib::Port   $listen_port = lookup('profile::prometheus::openstack_exporter::listen_port', {default_value => 12345}),
    String[1]      $cloud       = lookup('profile::prometheus::openstack_exporter::cloud', {default_value => 'eqiad1'}),
    Wmflib::Ensure $ensure      = lookup('profile::prometheus::openstack_exporter::ensure', {default_value => 'present'}),
){
    # package only available on bullseye
    debian::codename::require::min('bullseye')

    apt::package_from_component { 'prometheus-openstack-exporter':
        component => 'component/prometheus-openstack-exporter',
        packages  => { 'prometheus-openstack-exporter' => 'present'}
    }

    $config_file = '/etc/prometheus-openstack-exporter.yaml'

    file { $config_file:
        ensure  => stdlib::ensure($ensure, 'file'),
        owner   => 'prometheus',
        group   => 'prometheus',
        mode    => '0440',
        content => template('profile/prometheus/openstack-exporter.yaml.erb'),
    }

    file { '/usr/local/sbin/prometheus-openstack-exporter-wrapper':
        ensure => stdlib::ensure($ensure, 'file'),
        source => 'puppet:///modules/profile/prometheus/prometheus-openstack-exporter-wrapper.sh',
        owner  => 'root',
        group  => 'root',
        mode   => '0500',
    }

    systemd::service { 'prometheus-openstack-exporter':
        ensure    => $ensure,
        content   => systemd_template('prometheus-openstack-exporter'),
        restart   => true,
        override  => false,
        require   => File[$config_file],
        subscribe => [
            File[$config_file],
        ],
    }

}