Puppet Class: profile::openstack::base::rabbitmq
- Defined in:
- modules/profile/manifests/openstack/base/rabbitmq.pp
Summary
Cloud VPS OpenStack RabbitMQ message queue serverOverview
SPDX-License-Identifier: Apache-2.0 There are two similarly-named params here, '$rabbitmq_setup_nodes' and '$rabbitmq_nodes':
$rabbitmq_nodes is the list of nodes that rabbitmq clients should actually use; it will generally
consist of wikimediacloud.org service names rather than physical hardware fqdns. These values
will be baked into unpuppetized Trove VMs and so should be changed as little as possible; changes
to active rabbit nodes should be made via dns changes to the service fqdns.
$rabbitmq_setup_nodes is a list of fqdns of hosts that are configured by this class but not yet
in service. It exists to stage new rabbitmq nodes (with firewalls and such) before switching
traffic over. It should consist of primary fqdns (.wikimedia.org or .wmnet)
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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'modules/profile/manifests/openstack/base/rabbitmq.pp', line 19
class profile::openstack::base::rabbitmq(
Array[Stdlib::Fqdn] $rabbitmq_nodes = lookup('profile::openstack::base::rabbitmq_nodes'),
Array[Stdlib::Fqdn] $rabbitmq_setup_nodes = lookup('profile::openstack::base::rabbitmq_setup_nodes'),
Stdlib::Fqdn $rabbitmq_service_name = lookup('profile::openstack::base::rabbitmq_service_name'),
Stdlib::Fqdn $rabbitmq_own_name = lookup('profile::openstack::base::rabbitmq::rabbitmq_own_name'),
$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'),
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_rabbit_user = lookup('profile::openstack::base::trove::rabbit_user'),
String $trove_rabbit_pass = lookup('profile::openstack::base::trove::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'),
String $heat_rabbit_user = lookup('profile::openstack::base::heat::rabbit_user'),
String $heat_rabbit_password = lookup('profile::openstack::base::heat::rabbit_pass'),
String $magnum_rabbit_user = lookup('profile::openstack::base::magnum::rabbit_user'),
String $magnum_rabbit_password = lookup('profile::openstack::base::magnum::rabbit_pass'),
String $cinder_rabbit_user = lookup('profile::openstack::base::cinder::rabbit_user'),
String $cinder_rabbit_password = lookup('profile::openstack::base::cinder::rabbit_pass'),
String $designate_rabbit_user = lookup('profile::openstack::base::designate::rabbit_user'),
String $designate_rabbit_password = lookup('profile::openstack::base::designate::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}),
Integer $heartbeat_timeout = lookup('profile::openstack::base::heartbeat_timeout'),
String $version = lookup('profile::openstack::base::version'),
Stdlib::IP::Address::V4 $cloud_private_supernet = lookup('profile::wmcs::cloud_private_subnet::supernet'),
){
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'],
hosts => [
$facts['networking']['fqdn'],
$rabbitmq_service_name,
$rabbitmq_own_name,
].unique(),
}
)
$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,
heartbeat_timeout => $heartbeat_timeout,
}
contain '::rabbitmq'
# https://www.rabbitmq.com/management.html
# Needed for https://www.rabbitmq.com/management-cli.html
rabbitmq::plugin { 'rabbitmq_management': }
# This installs some things we don't need but also sets up
# the versioned repo which will get us the latest version-specific
# rabbitmq packages
class { "openstack::serverpackages::${version}::${::lsbdistcodename}":
}
file { '/etc/rabbitmq/rabbitmq-env.conf':
owner => 'rabbitmq',
group => 'rabbitmq',
mode => '0644',
content => template('profile/openstack/base/rabbitmq/rabbitmq-env.conf.erb'),
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 => $rabbitmq_nodes[0] == $rabbitmq_service_name,
}
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::heat::rabbit':
username => $heat_rabbit_user,
password => $heat_rabbit_password,
}
class { '::openstack::magnum::rabbit':
username => $magnum_rabbit_user,
password => $magnum_rabbit_password,
}
class { '::openstack::cinder::rabbit':
username => $cinder_rabbit_user,
password => $cinder_rabbit_password,
}
class { '::openstack::designate::rabbit':
username => $designate_rabbit_user,
password => $designate_rabbit_password,
}
class { '::openstack::trove::rabbit':
username => $trove_rabbit_user,
password => $trove_rabbit_pass,
guest_username => $trove_guest_rabbit_user,
guest_password => $trove_guest_rabbit_pass,
}
rabbitmq::plugin { 'rabbitmq_prometheus': }
# One more rabbit metric that isn't provided by the standard plugin
file { '/usr/local/sbin/detect_rabbit_partition':
owner => 'root',
group => 'root',
mode => '0744',
source => 'puppet:///modules/profile/openstack/base/rabbitmq/detect_rabbit_partition.py',
}
systemd::timer::job { 'rabbitmq_detect_partition':
ensure => present,
description => 'Update prometheus metric about rabbit network partition',
command => '/usr/local/sbin/detect_rabbit_partition',
user => 'root',
interval => {'start' => 'OnCalendar', 'interval' => '*:0/2'}
}
firewall::service { 'rabbitmq-cloud-private':
proto => 'tcp',
port => [5671, 5672],
srange => $cloud_private_supernet,
}
firewall::service { 'rabbitmq-internals':
proto => 'tcp',
port => [4369, 5671, 5672, 25672],
srange => $rabbitmq_nodes + $rabbitmq_setup_nodes,
}
firewall::service { 'rabbitmq-cloud-vps-instances':
proto => 'tcp',
port => [5671, 5672],
src_sets => ['CLOUD_NETWORKS'],
}
}
|