Puppet Class: rabbitmq

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

Overview

Parameters:

  • running (Any) (defaults to: true)
  • file_handles (Any) (defaults to: '1024')
  • erlang_cookie (Any) (defaults to: '')


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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'modules/rabbitmq/manifests/init.pp', line 18

class rabbitmq(
    $running = true,
    $file_handles = '1024',
    $erlang_cookie = '',
    ) {

    package { [ 'rabbitmq-server' ]:
        ensure  => 'present',
    }

    file { '/etc/default/rabbitmq-server':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('rabbitmq/rabbitmq-server.default.erb'),
        require => Package['rabbitmq-server'],
        notify  => Service['rabbitmq-server'],
    }

    file { '/usr/local/sbin/rabbitmqadmin':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0655',
        source  => 'puppet:///modules/rabbitmq/rabbitmqadmin.py',
        require => Package['rabbitmq-server'],
    }

    file { '/etc/rabbitmq/rabbitmq.config':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        source  => 'puppet:///modules/rabbitmq/rabbitmq.config',
        require => Package['rabbitmq-server'],
    }

    file {'/usr/local/sbin/rabbit_random_guest':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0655',
        source  => 'puppet:///modules/rabbitmq/rabbit_random_guest.sh',
        require => Package['rabbitmq-server'],
    }

    # For multi-node setups, the two servers need to share
    #  this secret string.  For single-node setups
    #  we can just let rabbit generate whatever.
    if $erlang_cookie {
        file { '/var/lib/rabbitmq/.erlang.cookie':
            ensure  => 'present',
            owner   => 'rabbitmq',
            group   => 'rabbitmq',
            mode    => '0400',
            content => $erlang_cookie,
            require => Package['rabbitmq-server'],
        }
    }

    exec { 'invalidate_rabbitmq_guest_account':
        command     => '/usr/local/sbin/rabbit_random_guest',
        subscribe   => File['/usr/local/sbin/rabbit_random_guest'],
        refreshonly => true,
    }

    service { 'rabbitmq-server':
        ensure  => $running,
        require => Package['rabbitmq-server'],
    }
}