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

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

Overview

Parameters:

  • region (String) (defaults to: lookup('profile::openstack::base::region'))
  • 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'))
  • nova_rabbit_user (String) (defaults to: lookup('profile::openstack::base::nova::rabbit_user'))
  • nova_rabbit_password (String) (defaults to: lookup('profile::openstack::base::nova::rabbit_pass'))
  • neutron_rabbit_user (String) (defaults to: lookup('profile::openstack::base::neutron::rabbit_user'))
  • neutron_rabbit_password (String) (defaults to: lookup('profile::openstack::base::neutron::rabbit_pass'))
  • trove_guest_rabbit_user (String) (defaults to: lookup('profile::openstack::base::trove::trove_guest_rabbit_user'))
  • trove_guest_rabbit_pass (String) (defaults to: lookup('profile::openstack::base::trove::trove_guest_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
# File 'modules/profile/manifests/openstack/base/rabbitmq.pp', line 1

class profile::openstack::base::rabbitmq(
    String $region = lookup('profile::openstack::base::region'),
    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'),
    String $nova_rabbit_user = lookup('profile::openstack::base::nova::rabbit_user'),
    String $nova_rabbit_password = lookup('profile::openstack::base::nova::rabbit_pass'),
    String $neutron_rabbit_user = lookup('profile::openstack::base::neutron::rabbit_user'),
    String $neutron_rabbit_password = lookup('profile::openstack::base::neutron::rabbit_pass'),
    String $trove_guest_rabbit_user = lookup('profile::openstack::base::trove::trove_guest_rabbit_user'),
    String $trove_guest_rabbit_pass = lookup('profile::openstack::base::trove::trove_guest_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'],
            {
                outdir        => '/etc/rabbitmq/ssl',
                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,
    }

    class { '::openstack::neutron::rabbit':
        username => $neutron_rabbit_user,
        password => $neutron_rabbit_password,
    }

    class { '::openstack::trove::rabbit':
        guest_username => $trove_guest_rabbit_user,
        guest_password => $trove_guest_rabbit_pass,
    }

    rabbitmq::plugin { 'rabbitmq_prometheus': }

    ferm::service { 'rabbitmq-internals':
        proto  => 'tcp',
        port   => '(4369 5671 5672 25672)',
        # TODO: change openstack_controllers to something else when we have dedicated rabbit nodes
        srange => "(@resolve((${openstack_controllers.join(' ')})))",
    }

    $hosts_ranges = $::network::constants::cloud_nova_hosts_ranges[$region]

    ferm::service { 'rabbitmq-nova-hosts':
        proto  => 'tcp',
        port   => '(5671 5672)',
        srange => "(${hosts_ranges.join(' ')})",
    }

    ferm::service { 'rabbitmq-openstack-control':
        proto  => 'tcp',
        port   => '(5671 5672)',
        srange => "(@resolve((${openstack_controllers.join(' ')})))",
    }

    ferm::service { 'rabbitmq-designate':
        proto  => 'tcp',
        port   => '(5671 5672)',
        srange => "(@resolve((${designate_hosts.join(' ')})))",
    }

    ferm::service { 'rabbitmq-cinder-backup':
        proto  => 'tcp',
        port   => '(5671 5672)',
        srange => "(@resolve((${cinder_backup_nodes.join(' ')})))",
    }

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