From 36344a9f6cf58085f738591a847a7d2a602fd896 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Fri, 9 Jan 2015 15:41:16 +0100 Subject: [PATCH] Separate step for RabbitMQ deploy Configures RabbitMQ for Openstack infrastructure controllers Related blueprint fuel-library-modularization Change-Id: Ifa0e3b179ed58447e5b958271876bbf9fbff77a1 Signed-off-by: Bogdan Dobrelya --- .../puppet/openstack/manifests/controller.pp | 3 - .../openstack/manifests/nova/controller.pp | 46 +------ .../modular/rabbitmq/rabbitmq.pp | 125 ++++++++++++++++++ .../osnailyfacter/modular/rabbitmq/tasks.yaml | 9 ++ 4 files changed, 135 insertions(+), 48 deletions(-) create mode 100644 deployment/puppet/osnailyfacter/modular/rabbitmq/rabbitmq.pp create mode 100644 deployment/puppet/osnailyfacter/modular/rabbitmq/tasks.yaml diff --git a/deployment/puppet/openstack/manifests/controller.pp b/deployment/puppet/openstack/manifests/controller.pp index d6147cb830..2b03b05b4c 100644 --- a/deployment/puppet/openstack/manifests/controller.pp +++ b/deployment/puppet/openstack/manifests/controller.pp @@ -219,9 +219,6 @@ class openstack::controller ( $idle_timeout = '3600', ) { - Class[$queue_provider] -> Nova_config <||> - Class[$queue_provider] -> Cinder_config <||> - Class[$queue_provider] -> Neutron_config <||> ######## BEGIN NOVA ########### # diff --git a/deployment/puppet/openstack/manifests/nova/controller.pp b/deployment/puppet/openstack/manifests/nova/controller.pp index 529f118335..1da41f20df 100644 --- a/deployment/puppet/openstack/manifests/nova/controller.pp +++ b/deployment/puppet/openstack/manifests/nova/controller.pp @@ -182,51 +182,7 @@ class openstack::nova::controller ( # Install / configure queue provider case $queue_provider { 'rabbitmq': { - # NOTE(bogdnado) Debian family will use key_content, Rhel will use key_source. - # key_source - source method, should be a file name for rpm or url for apt/rpm - # key_content - content method, should be a template for apt::source class, overrides key_source - class { '::rabbitmq': - repos_ensure => false, - package_provider => $package_provider, - package_source => undef, - service_ensure => 'running', - service_manage => $enabled, - port => $rabbitmq_bind_port, - delete_guest_user => true, - default_user => $amqp_user, - default_pass => $amqp_password, - # Set to true and uncomment the lines below, if puppet should create a cluster - config_cluster => false, - #TODO(bogdando) make erlang cookie as a hiera(astute) value. - # this one was a default for old rabbitmq::server, but is required now - #erlang_cookie => 'EOKOWXQREETZSHFNTPEY', - #wipe_db_on_cookie_change => true, - #cluster_nodes => $rabbitmq_cluster_nodes, - #cluster_node_type => 'disc', - #cluster_partition_handling => $cluster_partition_handling, - version => '3.3.5', - node_ip_address => $rabbitmq_bind_ip_address, - config_kernel_variables => $config_kernel_variables, - config_variables => $config_variables, - environment_variables => $environment_variables, - } - class { 'nova::rabbitmq': - enabled => $enabled, - # Do not install rabbitmq from nova classes - rabbitmq_class => false, - userid => $amqp_user, - password => $amqp_password, - require => Class['::rabbitmq'], - } - if ($ha_mode and $enabled) { - class { 'pacemaker_wrappers::rabbitmq': - command_timeout => $command_timeout, - debug => $debug, - #TODO(bogdando) make erlang cookie as a hiera(astute) value. - erlang_cookie => 'EOKOWXQREETZSHFNTPEY', - before => Class['nova::rabbitmq'], - } - } + notice("Rabbitmq server should be already installed and configured.") } 'qpid': { class { 'qpid::server': diff --git a/deployment/puppet/osnailyfacter/modular/rabbitmq/rabbitmq.pp b/deployment/puppet/osnailyfacter/modular/rabbitmq/rabbitmq.pp new file mode 100644 index 0000000000..fe0c84b0e1 --- /dev/null +++ b/deployment/puppet/osnailyfacter/modular/rabbitmq/rabbitmq.pp @@ -0,0 +1,125 @@ +notice('MODULAR: rabbitmq.pp') + +$queue_provider = hiera('queue_provider', 'rabbitmq') + +if $queue_provider == 'rabbitmq' { + $enabled = true + $erlang_cookie = hiera('erlang_cookie', 'EOKOWXQREETZSHFNTPEY') + $version = hiera('rabbit_version', '3.3.5') + $debug = hiera('debug', false) + $deployment_mode = hiera('deployment_mode', 'ha_compact') + $amqp_port = hiera('amqp_port', '5673') + $rabbit_hash = hiera('rabbit_hash', + { + 'user' => false, + 'password' => false, + } + ) + + case $::osfamily { + 'RedHat': { + $command_timeout = "'-s KILL'" + $package_provider = 'yum' + } + 'Debian': { + $command_timeout = "'--signal=KILL'" + $package_provider = 'apt' + } + default: { + fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem},\ + module ${module_name} only support osfamily RedHat and Debian") + } + } + + if ($debug) { + $rabbit_levels = '[connection,debug,info,error]' + } else { + $rabbit_levels = '[connection,info,error]' + } + + $cluster_partition_handling = hiera('rabbit_cluster_partition_handling', 'autoheal') + $rabbitmq_bind_ip_address = hiera('rabbitmq_bind_ip_address','UNSET') + # NOTE(bogdando) not a hash. Keep an indentation as is + $rabbit_tcp_listen_options = hiera('rabbit_tcp_listen_options', + '[ + binary, + {packet, raw}, + {reuseaddr, true}, + {backlog, 128}, + {nodelay, true}, + {exit_on_close, false}, + {keepalive, true} + ]' + ) + $config_kernel_variables = hiera('rabbit_config_kernel_variables', + { + 'inet_dist_listen_min' => '41055', + 'inet_dist_listen_max' => '41055', + 'inet_default_connect_options' => '[{nodelay,true}]', + } + ) + $config_variables = hiera('rabbit_config_variables', + { + 'log_levels' => $rabbit_levels, + 'default_vhost' => "<<\"/\">>", + 'default_permissions' => '[<<".*">>, <<".*">>, <<".*">>]', + 'tcp_listen_options' => $rabbit_tcp_listen_options, + 'cluster_partition_handling' => $cluster_partition_handling, + } + ) + if $deployment_mode == 'ha_compact' { + $rabbit_pid_file = '/var/run/rabbitmq/p_pid' + } else { + $rabbit_pid_file = '/var/run/rabbitmq/pid' + } + $environment_variables = hiera('rabbit_environment_variables', + { + 'SERVER_ERL_ARGS' => '"+K true +A30 +P 1048576"', + 'PID_FILE' => $rabbit_pid_file, + } + ) + + class { '::rabbitmq': + repos_ensure => false, + package_provider => $package_provider, + package_source => undef, + service_ensure => 'running', + service_manage => true, + port => $amqp_port, + delete_guest_user => true, + default_user => $rabbit_hash['user'], + default_pass => $rabbit_hash['password'], + # NOTE(bogdando) set to true and uncomment the lines below, if puppet should create a cluster + # We don't want it as far as OCF script creates the cluster + config_cluster => false, + #erlang_cookie => $erlang_cookie, + #wipe_db_on_cookie_change => true, + #cluster_nodes => $rabbitmq_cluster_nodes, + #cluster_node_type => 'disc', + #cluster_partition_handling => $cluster_partition_handling, + version => $version, + node_ip_address => $rabbitmq_bind_ip_address, + config_kernel_variables => $config_kernel_variables, + config_variables => $config_variables, + environment_variables => $environment_variables, + } + + class { 'nova::rabbitmq': + enabled => $enabled, + # Do not install rabbitmq from nova classes + rabbitmq_class => false, + userid => $rabbit_hash['user'], + password => $rabbit_hash['password'], + require => Class['::rabbitmq'], + } + + if $enabled { + class { 'pacemaker_wrappers::rabbitmq': + command_timeout => $command_timeout, + debug => $debug, + #TODO(bogdando) make erlang cookie as a hiera(astute) value. + erlang_cookie => 'EOKOWXQREETZSHFNTPEY', + before => Class['nova::rabbitmq'], + } + } +} diff --git a/deployment/puppet/osnailyfacter/modular/rabbitmq/tasks.yaml b/deployment/puppet/osnailyfacter/modular/rabbitmq/tasks.yaml new file mode 100644 index 0000000000..192d485ad1 --- /dev/null +++ b/deployment/puppet/osnailyfacter/modular/rabbitmq/tasks.yaml @@ -0,0 +1,9 @@ +- id: rabbitmq + type: puppet + groups: [primary-controller, controller] + required_for: [deploy_end, openstack-controller, glance] + requires: [openstack-haproxy] + parameters: + puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/rabbitmq/rabbitmq.pp + puppet_modules: /etc/puppet/modules + timeout: 3600