diff --git a/README.md b/README.md index 6ae4983..6700e89 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,22 @@ None ## default ## -- configures the messaging service selected by attributes +Selects the messaging service selected by the attribute `['openstack']['messaging']['service']`. + +## rabbitmq ## + +Currently the only supported messaging service. Defaults to using the latest release from RabbitMQ.org. Override any attributes from the [rabbitmq cookbook](https://github.com/opscode-cookbooks/rabbitmq) to change behavior. # Attributes # +* `default['openstack']['role']['messaging']` - which role should other nodes search on to find the messaging service, defaults to 'os-ops-messaging' +* `default['openstack']['messaging']['service']` - which service to use, defaults to 'rabbitmq' +* `default['openstack']['messaging']['host']` - messaging host +* `default['openstack']['messaging']['port']` - messaging port +* `default['openstack']['messaging']['user']` - messaging user, default is 'rabbit' +* `default['openstack']['messaging']['password']` - password, default is 'password' +* `default['openstack']['messaging']['vhost']` - messaging vhost, defaults to '/nova' + # Templates # None @@ -37,6 +49,7 @@ License and Author | | | |:---------------------|:---------------------------------------------------| +| **Author** | John Dewey () | | **Author** | Justin Shepherd () | | **Author** | Jason Cannavale () | | **Author** | Ron Pedde () | @@ -46,10 +59,10 @@ License and Author | **Author** | Evan Callicoat () | | **Author** | Matt Ray () | | | | +| **Copyright** | Copyright 2012, John Dewey | | **Copyright** | Copyright (c) 2012-2013, Rackspace US, Inc. | | **Copyright** | Copyright (c) 2012-2013, Opscode, Inc. | - Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/attributes/default.rb b/attributes/default.rb new file mode 100644 index 0000000..f755495 --- /dev/null +++ b/attributes/default.rb @@ -0,0 +1,13 @@ +default['openstack']['role']['messaging'] = 'os-ops-messaging' + +default['openstack']['messaging']['service'] = 'rabbitmq' + +# default['rabbitmq']['port'] = 5672 +# default['rabbitmq']['address'] = '0.0.0.0' + +default['openstack']['messaging']['host'] = node['rabbitmq']['address'] +default['openstack']['messaging']['port'] = node['rabbitmq']['port'] +default['openstack']['messaging']['user'] = 'rabbit' +default['openstack']['messaging']['password'] = 'password' +default['openstack']['messaging']['vhost'] = '/nova' + diff --git a/metadata.rb b/metadata.rb new file mode 100644 index 0000000..0fd76d6 --- /dev/null +++ b/metadata.rb @@ -0,0 +1,15 @@ +name "openstack-ops-messaging" +maintainer "Opscode, Inc." +maintainer_email "matt@opscode.com" +license "Apache 2.0" +description "Provides the shared messaging configuration for Chef for OpenStack." +version "0.1.0" + +recipe "default", "Selects messaging service." +recipe "rabbitmq", "Configures RabbitMQ." + +%w{ ubuntu }.each do |os| + supports os +end + +depends "rabbitmq", ">= 2.0.0" diff --git a/recipes/default.rb b/recipes/default.rb new file mode 100644 index 0000000..10fc737 --- /dev/null +++ b/recipes/default.rb @@ -0,0 +1,20 @@ +# +# Cookbook Name:: openstack-ops-messaging +# Recipe:: default +# +# Copyright 2013, Opscode, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +include_recipe "openstack-ops-messaging::#{node['openstack']['messaging']['service']}" diff --git a/recipes/rabbitmq.rb b/recipes/rabbitmq.rb new file mode 100644 index 0000000..45161b0 --- /dev/null +++ b/recipes/rabbitmq.rb @@ -0,0 +1,52 @@ +# +# Cookbook Name:: openstack-ops-messaging +# Recipe:: rabbitmq +# +# Copyright 2013, Opscode, Inc. +# Copyright 2012, John Dewey +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +include_recipe "rabbitmq" +include_recipe "rabbitmq::mgmt_console" + +user = node['openstack']['messaging']['user'] +vhost = node['openstack']['messaging']['vhost'] + +# remove the guest user +rabbitmq_user 'guest' do + action :delete + not_if { user.eql?('guest') } +end + +rabbitmq_user user do + password node['openstack']['messaging']['password'] + action :add +end + +rabbitmq_vhost vhost do + action :add +end + +rabbitmq_user user do + vhost vhost + permissions ".* .* .*" + action :set_permissions +end + +# Necessary for graphing. +rabbitmq_user user do + tag "administrator" + action :set_tags +end