Puppet Class: rabbitmq::cleanup

Defined in:
modules/rabbitmq/manifests/cleanup.pp

Overview

Parameters:

  • password (Any)
  • enabled (Any) (defaults to: false)
  • username (Any) (defaults to: 'drainqueue')


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
# File 'modules/rabbitmq/manifests/cleanup.pp', line 8

class rabbitmq::cleanup(
    $password,
    $enabled=false,
    $username='drainqueue',
    ) {

    require rabbitmq

    if ! ($password) {
        fail("password must be set for ${name}")
    }

    file { '/usr/local/sbin/drain_queue':
        ensure => 'present',
        owner  => 'root',
        group  => 'root',
        mode   => '0655',
        source => 'puppet:///modules/rabbitmq/drain_queue.py',
    }

    # admin is needed for queue cleanup
    rabbitmq::user{'drainqueue':
        username      => $username,
        password      => $password,
        administrator => true,
    }

    if ($enabled) {
        $cron_ensure = 'present'
    }
    else {
        $cron_ensure = 'absent'
    }

    # These logfiles will be rotated by an already-existing wildcard logrotate rule for rabbit
    cron { 'drain and log rabbit notifications.error queue':
            ensure  => $cron_ensure,
            user    => 'root',
            minute  => '35',
            command => "/usr/local/sbin/drain_queue notifications.error --password ${password} >> /var/log/rabbitmq/notifications_error.log 2>&1",
    }
}