fuel-library/deployment/puppet/nova/manifests/rabbitmq.pp
Bogdan Dobrelya 507d54e4c9 Adapt rabbitmq module for Fuel
* Sync to v5.0.0 (supports Ubuntu 14.04, major SSL fixes)
* Fix deprecated in 5.0.0 params
* Reimplement waiting/retries in rabbitmq provider
  (https://tickets.puppetlabs.com/browse/MODULES-1452)
* Configure clustering with an erlang cookie hardcode. Also
  pass the cookie to the OCF script.
* Make OCF script always update an erlang cookie, if specified
  (default false)
* Add dependency module: nanliu-staging
* Add support for rabbimtq class false value for nova module
  (https://bugs.launchpad.net/puppet-nova/+bug/1407077)
* Do not use nova::rabbitmq to install and configure rabbitmq
  service anymore, install it separately.
  (TODO move it as a granular deploy step)
* Adjust other existing rabbit class calls for new 5.0.0 rabbit module
* Remove deprecated usage of rabbitmq::server class and replace it
  to ::rabbitmq (cinder, murano, openstack, zabbix, mcollective,
  nailgun)
* Remove rabbit.pub.key and do not manage repos for rabbit package
  as we have it in nailgun repos and Fuel uses these repos for offline
  installation of rabbitmq.
  (Related upstream bug https://tickets.puppetlabs.com/browse/MODULES-1631)
* Move custom rabbit OCF file from nova to openstack and remove
  OS-aware services disable from rabbit's manifests
* Make pacemaker provider HA wrapper for rabbitmq service and move
  it to pacemaker_wrappers::rabbitmq
* Fix linting
* Fix rabbitmq service name for zabbix mon
* Fix env_config for rabbitmq::nailgun, unify RABBIT_* env args.
* Use key_content, package_gpg_key, config_*, cluster_*,
  environment_* params to ensure the same rabbit configuration as
  before and make offline installation possible.
* Add cluster_partition_handling param for openstack::controller
* Del unused rabbitmq_node_ip_address and rename as node_ip_address
* Del unneeded rabbit_cluster due to it is being evaluated via
  passed rabbitmq_cluster_nodes as well
* Adjust debug log_levels for rabbit config as well
* For '$production !~ /docker/' case, remove custom init scripts
  for rabbit as non relevant anymore.
* Enable rspec tests for rabbitmq in utils
* Disable rspecs for erlang module.

Related blueprint merge-openstack-puppet-modules
Related-bug: #1377491

Change-Id: I6e631b975c5835d2d6f1984d5a070a45231fe9ab
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
2015-01-09 16:11:28 +01:00

104 lines
2.9 KiB
Puppet

# == Class: nova::rabbitmq
#
# Installs and manages rabbitmq server for nova
#
# == Parameters:
#
# [*userid*]
# (optional) The username to use when connecting to Rabbit
# Defaults to 'guest'
#
# [*password*]
# (optional) The password to use when connecting to Rabbit
# Defaults to 'guest'
#
# [*port*]
# (optional) The port to use when connecting to Rabbit
# Defaults to '5672'
#
# [*virtual_host*]
# (optional) The virtual host to use when connecting to Rabbit
# Defaults to '/'
#
# [*cluster_disk_nodes*]
# (optional) Enables/disables RabbitMQ clustering. Specify an array of Rabbit Broker
# IP addresses to configure clustering.
# Defaults to false
#
# [*enabled*]
# (optional) Whether to enable the Rabbit service
# Defaults to false
#
# [*rabbitmq_class*]
# (optional) The rabbitmq puppet class to depend on,
# which is dependent on the puppet-rabbitmq version.
# Use the default for 1.x, use 'rabbitmq' for 3.x.
# Use false, if rabbitmq class should not be configured
# here
# Defaults to 'rabbitmq::server'
#
class nova::rabbitmq(
$userid ='guest',
$password ='guest',
$port ='5672',
$virtual_host ='/',
$cluster_disk_nodes = false,
$enabled = true,
$rabbitmq_class = 'rabbitmq::server'
) {
if ($enabled) {
if $userid == 'guest' {
$delete_guest_user = false
} else {
$delete_guest_user = true
rabbitmq_user { $userid:
admin => true,
password => $password,
provider => 'rabbitmqctl',
}
# I need to figure out the appropriate permissions
rabbitmq_user_permissions { "${userid}@${virtual_host}":
configure_permission => '.*',
write_permission => '.*',
read_permission => '.*',
provider => 'rabbitmqctl',
}->Anchor<| title == 'nova-start' |>
}
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
# TODO(bogdando) contribute this to puppet-nova as they
# do not want nova manage rabbitmq service anymore.
if $rabbitmq_class {
if $cluster_disk_nodes {
class { $rabbitmq_class:
service_ensure => $service_ensure,
port => $port,
delete_guest_user => $delete_guest_user,
config_cluster => true,
cluster_disk_nodes => $cluster_disk_nodes,
wipe_db_on_cookie_change => true,
}
} else {
class { $rabbitmq_class:
service_ensure => $service_ensure,
port => $port,
delete_guest_user => $delete_guest_user,
}
}
Class[$rabbitmq_class] -> Rabbitmq_user<| title == $userid |>
Class[$rabbitmq_class] -> Rabbitmq_vhost<| title == $virtual_host |>
# only configure nova after the queue is up
Class[$rabbitmq_class] -> Anchor<| title == 'nova-start' |>
}
if ($enabled) {
rabbitmq_vhost { $virtual_host:
provider => 'rabbitmqctl',
}
}
}