Refactor usage of puppet-rabbitmq

This refactors current usage of puppet-rabbitmq. Details follow below.

- the rabbitmql class supports the ipv6 parameter which injects
  the required definitions to use IPv6

- ssl options are ignored if rabbitlqm::ssl is false

- we can use native parameters to define the bind address

Change-Id: Id33b56f84b04f0086f0e19e1938f36d109e4a188
This commit is contained in:
Takashi Kajinami 2023-03-07 23:29:47 +09:00
parent 863628b2fe
commit fe83b5488d
3 changed files with 32 additions and 36 deletions

View File

@ -101,6 +101,9 @@ fi
if [ -d /var/log/rabbitmq ]; then if [ -d /var/log/rabbitmq ]; then
sudo cp -r /var/log/rabbitmq $LOG_DIR sudo cp -r /var/log/rabbitmq $LOG_DIR
fi fi
if [ -f /var/lib/rabbitmq/erl_crash.dump ]; then
sudo cp /var/lib/rabbitmq/erl_crash.dump $LOG_DIR
fi
# db logs # db logs
# postgresql # postgresql

View File

@ -48,27 +48,17 @@ class openstack_integration::config (
$rabbit_port = $messaging_notify_port $rabbit_port = $messaging_notify_port
if $ipv6 { if $ipv6 {
$host = '::1' $host = '::1'
if $rpc_backend == 'rabbit' { $ip_version = '6'
$rabbit_env = {
'RABBITMQ_NODE_IP_ADDRESS' => $host,
'RABBITMQ_SERVER_START_ARGS' => '"-proto_dist inet6_tcp"',
'LC_ALL' => 'en_US.UTF-8',
}
}
$ip_version = '6'
# Note (dmsimard): ipv6 parsing in Swift and keystone_authtoken are # Note (dmsimard): ipv6 parsing in Swift and keystone_authtoken are
# different: https://bugs.launchpad.net/swift/+bug/1610064 # different: https://bugs.launchpad.net/swift/+bug/1610064
$memcached_servers = ["inet6:[${host}]:11211"] $memcached_servers = ["inet6:[${host}]:11211"]
$swift_memcached_servers = ["[${host}]:11211"] $swift_memcached_servers = ["[${host}]:11211"]
$tooz_url = "redis://[${host}]:6379" $tooz_url = "redis://[${host}]:6379"
} else { } else {
$host = '127.0.0.1' $host = '127.0.0.1'
$rabbit_env = { $ip_version = '4'
'LC_ALL' => 'en_US.UTF-8', $memcached_servers = ["${host}:11211"]
}
$ip_version = '4'
$memcached_servers = ["${host}:11211"]
$swift_memcached_servers = $memcached_servers $swift_memcached_servers = $memcached_servers
$tooz_url = "redis://${host}:6379" $tooz_url = "redis://${host}:6379"
} }

View File

@ -16,26 +16,29 @@ class openstack_integration::rabbitmq {
require => File['/etc/rabbitmq/ssl/private'], require => File['/etc/rabbitmq/ssl/private'],
notify => Service['rabbitmq-server'], notify => Service['rabbitmq-server'],
} }
class { 'rabbitmq': }
package_provider => $facts['package_provider'],
delete_guest_user => true, class { 'rabbitmq':
ssl => true, package_provider => $facts['package_provider'],
ssl_only => true, delete_guest_user => true,
ssl_cacert => $::openstack_integration::params::ca_bundle_cert_path, ssl => $::openstack_integration::config::ssl,
ssl_cert => $::openstack_integration::params::cert_path, ssl_only => $::openstack_integration::config::ssl,
ssl_key => "/etc/rabbitmq/ssl/private/${facts['networking']['fqdn']}.pem", # the parameters below are ignored when ssl is false
environment_variables => $::openstack_integration::config::rabbit_env, ssl_cacert => $::openstack_integration::params::ca_bundle_cert_path,
repos_ensure => false, ssl_cert => $::openstack_integration::params::cert_path,
manage_python => false, ssl_key => "/etc/rabbitmq/ssl/private/${facts['networking']['fqdn']}.pem",
} environment_variables => {
} else { 'LC_ALL' => 'en_US.UTF-8',
class { 'rabbitmq': },
package_provider => $facts['package_provider'], repos_ensure => false,
delete_guest_user => true, manage_python => false,
environment_variables => $::openstack_integration::config::rabbit_env, # the interface parameter is ignored if ssl_only is true
repos_ensure => false, interface => $::openstack_integration::config::host,
manage_python => false, # the ssl_interface parameter is ignored if ssl is false
} ssl_interface => $::openstack_integration::config::host,
node_ip_address => $::openstack_integration::config::host,
management_ip_address => $::openstack_integration::config::host,
ipv6 => $::openstack_integration::config::ipv6,
} }
rabbitmq_vhost { '/': rabbitmq_vhost { '/':
provider => 'rabbitmqctl', provider => 'rabbitmqctl',