Puppet Class: haproxykafka

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

Overview

Parameters:

  • ensure (Wmflib::Ensure)
  • config (Haproxykafka::Config)
  • user (String) (defaults to: 'haproxykafka')


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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'modules/haproxykafka/manifests/init.pp', line 19

class haproxykafka (
    Wmflib::Ensure       $ensure,
    Haproxykafka::Config $config,
    String               $user = 'haproxykafka',
) {
    package { 'haproxykafka':
        ensure => $ensure,
    }

    user { $user:
        ensure => $ensure,
        shell  => '/bin/false',
        home   => '/nonexistent',
        system => true,
    }

    $socketdir = '/var/run/haproxykafka'

    # TODO: from param/hiera
    file { $socketdir:
        ensure => stdlib::ensure($ensure, 'directory'),
        owner  => $user,
        group  => $user,
        mode   => '0755',
        force  => true,
    }

    $confdir = '/etc/haproxykafka'
    $conffile = 'config.yaml'
    $conffile_full_path = "${confdir}/${conffile}"

    file { $confdir:
        ensure => stdlib::ensure($ensure, 'directory'),
        force  => true,
    }

    file { $conffile_full_path:
        ensure  => $ensure,
        owner   => $user,
        mode    => '0444',
        content => to_yaml($config),
        require => [File[$confdir], Package['haproxykafka']],
    }

    systemd::service { 'haproxykafka':
        ensure   => $ensure,
        restart  => true,
        override => true,
        content  => init_template('haproxykafka', 'systemd_override'),
        require  => File[$conffile_full_path],
    }
}