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/rabbitmq/manifests/cleanup.pp', line 9
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{ $username:
password => $password,
administrator => true,
}
if ($enabled) {
$ensure = 'present'
}
else {
$ensure = 'absent'
}
# These logfiles will be rotated by an already-existing wildcard logrotate rule for rabbit
systemd::timer::job { 'drain_rabbitmq_notification_error':
ensure => $ensure,
description => 'Drain and log RabbitMQ notifications.error queue',
user => 'root',
command => "/usr/local/sbin/drain_queue notifications.error --password ${password}",
logfile_basedir => '/var/log/rabbitmq/',
logfile_name => 'notifications_error.log',
interval => {'start' => 'OnCalendar', 'interval' => '*:0/35:00'}
}
}
|