Puppet Class: haproxy::cloud::base

Defined in:
modules/haproxy/manifests/cloud/base.pp

Overview

Parameters:

  • mainfile (Stdlib::Filesource) (defaults to: 'puppet:///modules/haproxy/cloud/haproxy.cfg')


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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'modules/haproxy/manifests/cloud/base.pp', line 14

class haproxy::cloud::base (
    Stdlib::Filesource $mainfile = 'puppet:///modules/haproxy/cloud/haproxy.cfg',
) {
    package { 'haproxy':
        ensure => installed,
    }

    ensure_packages(['socat'])

    file { '/etc/haproxy/conf.d':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    file { '/etc/haproxy/haproxy.cfg':
        ensure => present,
        mode   => '0444',
        owner  => 'root',
        group  => 'root',
        source => $mainfile,
    }

    # this file is loaded as environmentfile in the .service file shipped by
    # the debian package in Buster
    file { '/etc/default/haproxy':
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => "EXTRAOPTS='-f /etc/haproxy/conf.d/'\n",
        notify  => Service['haproxy'],
    }

    logrotate::conf { 'haproxy':
        ensure => present,
        source => 'puppet:///modules/haproxy/cloud/logging/haproxy.logrotate',
    }

    rsyslog::conf { 'haproxy':
          source   => 'puppet:///modules/haproxy/cloud/logging/haproxy.rsyslog',
          priority => 49,
    }

    service { 'haproxy':
        ensure    => 'running',
        subscribe => [
            File['/etc/haproxy/haproxy.cfg'],
            File['/etc/default/haproxy'],
        ],
        restart   => '/usr/bin/systemctl reload haproxy.service'
    }
}