Puppet Class: purged

Defined in:
modules/purged/manifests/init.pp

Overview

SPDX-License-Identifier: Apache-2.0

Class: purged

Parameters:

  • backend_addr (String)
  • frontend_addr (String)
  • prometheus_addr (String)
  • frontend_workers (Integer)
  • backend_workers (Integer)
  • is_active (Boolean)
  • host_regex (Optional[String]) (defaults to: undef)
  • kafka_topics (Array[String]) (defaults to: [])
  • brokers (Array[String]) (defaults to: ['localhost:9092'])
  • stats_interval_ms (Integer) (defaults to: 60000)
  • kafka_conf_file (Stdlib::Absolutepath) (defaults to: '/etc/purged-kafka.conf')
  • tls (Optional[ATSkafka::TLS_settings]) (defaults to: undef)


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
46
47
48
49
50
51
52
# File 'modules/purged/manifests/init.pp', line 4

class purged (
    String $backend_addr,
    String $frontend_addr,
    String $prometheus_addr,
    Integer $frontend_workers,
    Integer $backend_workers,
    Boolean $is_active,
    Optional[String] $host_regex                      = undef,
    # Kafka-related configurations
    Array[String] $kafka_topics                       = [],
    Array[String] $brokers                            = ['localhost:9092'],
    Integer $stats_interval_ms                        = 60000,
    Stdlib::Absolutepath $kafka_conf_file             = '/etc/purged-kafka.conf',
    Optional[ATSkafka::TLS_settings] $tls             = undef,
) {
    package { 'purged':
        ensure => present,
    }

    $ensure = $is_active? {
        true    => 'present',
        default => 'absent',
    }

    $enable_kafka = ($kafka_topics != [])
    if $enable_kafka {
        # We use the hostname as group id for now, as every purged
        # will consume the same messages
        $group_id = $::hostname

        file { $kafka_conf_file:
            ensure  => $ensure,
            content => template('purged/purged-kafka.conf.erb'),
            mode    => '0444',
            notify  => Service['purged'],
        }
    }

    systemd::service { 'purged':
        ensure    => $ensure,
        content   => systemd_template('purged'),
        subscribe => Package['purged'],
        restart   => true,
    }

    profile::auto_restarts::service { 'purged':
        ensure => $ensure,
    }
}