Puppet Class: profile::openstack::base::rabbitmq

Defined in:
modules/profile/manifests/openstack/base/rabbitmq.pp

Overview

Parameters:

  • openstack_controllers (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::openstack::base::openstack_controllers'))
  • monitor_user (Any) (defaults to: lookup('profile::openstack::base::rabbit_monitor_user'))
  • monitor_password (Any) (defaults to: lookup('profile::openstack::base::rabbit_monitor_pass'))
  • cleanup_password (Any) (defaults to: lookup('profile::openstack::base::rabbit_cleanup_pass'))
  • file_handles (Any) (defaults to: lookup('profile::openstack::base::rabbit_file_handles'))
  • designate_hosts (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::openstack::base::designate_hosts'))
  • labs_hosts_range (Any) (defaults to: lookup('profile::openstack::base::labs_hosts_range'))
  • labs_hosts_range_v6 (Any) (defaults to: lookup('profile::openstack::base::labs_hosts_range_v6'))
  • nova_rabbit_user (Any) (defaults to: lookup('profile::openstack::base::nova::rabbit_user'))
  • nova_rabbit_password (Any) (defaults to: lookup('profile::openstack::base::nova::rabbit_pass'))
  • rabbit_erlang_cookie (Any) (defaults to: lookup('profile::openstack::base::rabbit_erlang_cookie'))
  • rabbit_cfssl_label (Optional[String]) (defaults to: lookup('profile::openstack::base::rabbitmq::rabbit_cfssl_label', {default_value => undef}))
  • cinder_backup_nodes (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::openstack::base::cinder::backup::nodes'))


1
2
3
4
5
6
7
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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'modules/profile/manifests/openstack/base/rabbitmq.pp', line 1

class profile::openstack::base::rabbitmq(
    Array[Stdlib::Fqdn] $openstack_controllers = lookup('profile::openstack::base::openstack_controllers'),
    $monitor_user = lookup('profile::openstack::base::rabbit_monitor_user'),
    $monitor_password = lookup('profile::openstack::base::rabbit_monitor_pass'),
    $cleanup_password = lookup('profile::openstack::base::rabbit_cleanup_pass'),
    $file_handles = lookup('profile::openstack::base::rabbit_file_handles'),
    Array[Stdlib::Fqdn] $designate_hosts = lookup('profile::openstack::base::designate_hosts'),
    $labs_hosts_range = lookup('profile::openstack::base::labs_hosts_range'),
    $labs_hosts_range_v6 = lookup('profile::openstack::base::labs_hosts_range_v6'),
    $nova_rabbit_user = lookup('profile::openstack::base::nova::rabbit_user'),
    $nova_rabbit_password = lookup('profile::openstack::base::nova::rabbit_pass'),
    $rabbit_erlang_cookie = lookup('profile::openstack::base::rabbit_erlang_cookie'),
    Optional[String] $rabbit_cfssl_label = lookup('profile::openstack::base::rabbitmq::rabbit_cfssl_label', {default_value => undef}),
    Array[Stdlib::Fqdn] $cinder_backup_nodes    = lookup('profile::openstack::base::cinder::backup::nodes'),
){
    if $rabbit_cfssl_label {
        $cert_paths = profile::pki::get_cert(
            $rabbit_cfssl_label,
            $facts['networking']['fqdn'],
            {
                provide_chain => true,
                owner         => 'rabbitmq',
                group         => 'rabbitmq',
                require       => Package['rabbitmq-server'],
                before        => File['/etc/rabbitmq/rabbitmq.config'],
                notify        => Service['rabbitmq-server'],
            }
        )

        $rabbitmq_tls_key_file = $cert_paths['key']
        $rabbitmq_tls_cert_file = $cert_paths['chained']
        $rabbitmq_tls_ca_file = '/etc/ssl/certs/wmf-ca-certificates.crt'
    } else {
        $rabbitmq_tls_key_file = undef
        $rabbitmq_tls_cert_file = undef
        $rabbitmq_tls_ca_file = undef
    }

    class { '::rabbitmq':
        file_handles  => $file_handles,
        erlang_cookie => $rabbit_erlang_cookie,
        tls_cert_file => $rabbitmq_tls_cert_file,
        tls_key_file  => $rabbitmq_tls_key_file,
        tls_ca_file   => $rabbitmq_tls_ca_file,
    }
    contain '::rabbitmq'

    # https://www.rabbitmq.com/management.html
    # Needed for https://www.rabbitmq.com/management-cli.html
    rabbitmq::plugin { 'rabbitmq_management': }

    file { '/etc/rabbitmq/rabbitmq-env.conf':
        owner   => 'rabbitmq',
        group   => 'rabbitmq',
        mode    => '0644',
        source  => 'puppet:///modules/profile/openstack/base/rabbitmq/rabbitmq-env.conf',
        require => Package['rabbitmq-server'],
        notify  => Service['rabbitmq-server'],
    }

    # We want this job to run on only one host; it doesn't matter which.
    class {'::rabbitmq::cleanup':
        password => $cleanup_password,
        enabled  => $::fqdn == $openstack_controllers[0],
    }
    contain '::rabbitmq::cleanup'

    class {'::openstack::nova::rabbit':
        username => $nova_rabbit_user,
        password => $nova_rabbit_password,
        require  => Class['::rabbitmq'],
    }
    contain '::openstack::nova::rabbit'

    if debian::codename::ge('bullseye') {
        rabbitmq::plugin { 'rabbitmq_prometheus': }
    } else {
        rabbitmq::user{"${monitor_user}-rabbituser":
            username      => $monitor_user,
            password      => $monitor_password,
            administrator => true,
            require       => Class['::rabbitmq'],
        }

        class { '::profile::prometheus::rabbitmq_exporter':
            rabbit_monitor_username => $monitor_user,
            rabbit_monitor_password => $monitor_password,
        }
        contain '::profile::prometheus::rabbitmq_exporter'
    }

    ferm::rule{'rabbit_for_designate':
        ensure => 'present',
        rule   =>  "saddr (@resolve((${join($designate_hosts,' ')})) @resolve((${join($designate_hosts,' ')}), AAAA))
                    proto tcp dport (5671 5672) ACCEPT;",
    }

    ferm::rule{'beam_nova':
        ensure => 'present',
        rule   =>  "saddr (${labs_hosts_range} ${labs_hosts_range_v6}) proto tcp dport (5672 56918) ACCEPT;",
    }

    ferm::rule { 'rabbit_for_standby_node':
        ensure => 'present',
        rule   => "saddr (@resolve((${join($openstack_controllers,' ')}))
                          @resolve((${join($openstack_controllers,' ')}), AAAA))
                   proto tcp dport (5671 5672) ACCEPT;",
    }

    # Rabbit uses epmd for clustering
    ferm::rule { 'epmd_for_rabbit':
        ensure => 'present',
        rule   => "saddr (@resolve((${join($openstack_controllers,' ')}))
                          @resolve((${join($openstack_controllers,' ')}), AAAA))
                   proto tcp dport 4369 ACCEPT;",
    }

    ferm::rule { 'rabbit_internode':
        ensure => 'present',
        rule   => "saddr (@resolve((${join($openstack_controllers,' ')}))
                          @resolve((${join($openstack_controllers,' ')}), AAAA))
                   proto tcp dport 25672 ACCEPT;",
    }

    # Allow labs instances to talk to rabbitmq.
    # We need this because Trove instances are orchestrated
    #  via rabbitmq.
    include network::constants
    $labs_networks = join($network::constants::labs_networks, ' ')

    ferm::service { 'rabbitmq-access-for-cloud-vps-instances':
        proto  => 'tcp',
        port   => '(5671 5672)',
        srange => "(${labs_networks})",
    }

    # cinder-backup requires access to rabbit
    ferm::rule { 'rabbit_for_cinder_backup_nodes':
        ensure => 'present',
        rule   => "saddr (@resolve((${join($cinder_backup_nodes,' ')}))
                          @resolve((${join($cinder_backup_nodes,' ')}), AAAA))
                   proto tcp dport (5671 5672) ACCEPT;",
    }
}