Moving to the rabbitmq-server with plugins included

This commit is contained in:
ashaposhnikov 2012-12-18 12:19:37 +00:00
parent cd4f32527b
commit 49a3c65411
6 changed files with 9 additions and 114 deletions

View File

@ -5,10 +5,6 @@ all: iso
ISOROOT:=$/isoroot
RABBITMQ_VERSION:=2.6.1
RABBITMQ_PLUGINS:=amqp_client-$(RABBITMQ_VERSION).ez rabbitmq_stomp-$(RABBITMQ_VERSION).ez
RABBITMQ_PLUGINS_URL:=http://www.rabbitmq.com/releases/plugins/v$(RABBITMQ_VERSION)
iso: $/nailgun-centos-6.3-amd64.iso
$/isoroot-centos.done: \
@ -42,14 +38,9 @@ $(addprefix $(ISOROOT)/EFI/BOOT/,$(EFI_FILES)):
@mkdir -p $(@D)
cp $(CENTOS_REPO_DIR)EFI/BOOT/$(@F) $(@D)
$(addprefix $(ISOROOT)/rabbitmq-plugins/v$(RABBITMQ_VERSION)/,$(RABBITMQ_PLUGINS)):
@mkdir -p $(@D)
wget -O $@ $(RABBITMQ_PLUGINS_URL)/$(@F)
$/isoroot-prepare.done: \
$(addprefix $(ISOROOT)/images/,$(IMAGES_FILES)) \
$(addprefix $(ISOROOT)/EFI/BOOT/,$(EFI_FILES)) \
$(addprefix $(ISOROOT)/rabbitmq-plugins/v$(RABBITMQ_VERSION)/,$(RABBITMQ_PLUGINS)) \
$(ISOROOT)/ks.cfg \
$(ISOROOT)/bootstrap_admin_node.sh
$(ACTION.TOUCH)

View File

@ -45,10 +45,6 @@ $/rpm-cirros.done: $/prep.done packages/rpm/specs/cirros-0.3.0.spec
rpmbuild -vv --define "_topdir `readlink -f $/`" -ba packages/rpm/specs/cirros-0.3.0.spec
$(ACTION.TOUCH)
$/rpm-rabbitmq-plugins.done: $/prep.done packages/rpm/specs/rabbitmq-plugins.spec
rpmbuild -vv --define "_topdir `readlink -f $/`" -ba packages/rpm/specs/rabbitmq-plugins.spec
$(ACTION.TOUCH)
$/rpm-nailgun-agent.done: $/prep.done \
packages/rpm/specs/nailgun-agent.spec \
$(addprefix bin/,$(call find-files,bin))
@ -78,7 +74,6 @@ $/rpm-nailgun-net-check.done: $/prep.done \
$(ACTION.TOUCH)
$(BUILD_DIR)/rpm/rpm.done: $/rpm-cirros.done \
$/rpm-rabbitmq-plugins.done \
$/rpm-nailgun-agent.done \
$/rpm-nailgun-mcagents.done \
$/rpm-nailgun-net-check.done

View File

@ -6,15 +6,17 @@ class mcollective::rabbitmq(
$rabbitmq_plugins_repo = "http://www.rabbitmq.com/releases/plugins",
){
Exec {path => '/usr/bin:/bin:/usr/sbin:/sbin'}
define mcollective_rabbitmq_safe_package(){
if ! defined(Package[$name]){
@package { $name : }
}
}
define access_to_stomp_port($port, $protocol='tcp') {
$rule = "-p $protocol -m state --state NEW -m $protocol --dport $port -j ACCEPT"
exec { "access_to_cobbler_${protocol}_port: $port":
exec { "access_to_cobbler_${protocol}_port: $port":
command => "iptables -t filter -I INPUT 1 $rule; \
/etc/init.d/iptables save",
unless => "iptables -t filter -S INPUT | grep -q \"^-A INPUT $rule\""
@ -32,14 +34,14 @@ class mcollective::rabbitmq(
config_stomp => true,
stomp_port => $stompport,
}
rabbitmq_user { $stompuser:
admin => true,
password => $stomppassword,
provider => 'rabbitmqctl',
require => Class['rabbitmq::server'],
}
rabbitmq_user_permissions { "${stompuser}@/":
configure_permission => '.*',
write_permission => '.*',
@ -47,10 +49,10 @@ class mcollective::rabbitmq(
provider => 'rabbitmqctl',
require => Class['rabbitmq::server'],
}
# TODO
# IMPLEMENT RABBITMQ PLUGIN TYPE IN rabbitmq MODULE
file {"/etc/rabbitmq/enabled_plugins":
content => template("mcollective/enabled_plugins.erb"),
owner => root,
@ -60,37 +62,4 @@ class mcollective::rabbitmq(
notify => Service["rabbitmq-server"],
}
# IT SEEMS THERE IS NO PACKAGED RABBITMQ PLUGINS
# FOR REDHAT BASED OS AND EVEN rabbitmq-plugins BINARY IS NOT INSTALLED.
# SO WE NEED TO INSTALL NEEDED PLUGINS BY HAND
# IT MUST BE IMPROVED IN FUTURE BY IMPLEMETING CORRESPONDING PUPPET TYPE
file {"/root/install_rabbitmq_plugin.sh":
content => template("mcollective/install_rabbitmq_plugin.sh.erb"),
owner => root,
group => root,
mode => 0755,
}
# IT IS NEEDED IN ORDER TO DOWNLOAD RABBITMQ PLUGINS
mcollective_rabbitmq_safe_package{ "wget": }
define mco_install_rabbitmq_plugin() {
exec {"mco_install_rabbitmq_plugin_${name}":
command => "/root/install_rabbitmq_plugin.sh ${name} install",
unless => "/root/install_rabbitmq_plugin.sh ${name} is_installed",
require => [
File["/root/install_rabbitmq_plugin.sh"],
Package['rabbitmq-server'],
],
}
}
mco_install_rabbitmq_plugin{"rabbitmq_stomp":}
mco_install_rabbitmq_plugin{"amqp_client":}
Package<| title == wget |> ->
Mco_install_rabbitmq_plugin<||> ->
File<| title == "/etc/rabbitmq/enabled_plugins" |>
}

View File

@ -1,58 +0,0 @@
#!/bin/sh
usage(){
echo "Usage: `basename $0` <plugin> <action>"
echo " possible actions: install is_installed"
exit 1
}
test $# -lt 2 && usage
plugin=$1
action=$2
get_version(){
local rv=`cat /root/installed_rabbitmq_version 2>/dev/null`
if test X$rv = X; then
rv=`(rpm -qa | grep rabbitmq-server | awk -F- '{print $3}') 2>/dev/null`
echo $rv > /root/installed_rabbitmq_version
else
echo $rv
fi
}
version=`get_version`
# echo "Installed rabbitmq-server version: ${version}"
plugins_dir="/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
repo="<%= rabbitmq_plugins_repo %>/v${version}"
is_installed(){
# echo "Checking if plugin ${plugin} already installed"
test -s "${plugins_dir}/${plugin}-${version}.ez"
}
install_plugin(){
# echo "Downloading and installing rabbitmq-server plugin: ${plugin}"
if (echo ${repo} | grep -q "^file"); then
repopath=`echo ${repo} | awk -F'file://' '{print $2}'`
cp "${repopath}/${plugin}-${version}.ez" "${plugins_dir}/${plugin}-${version}.ez"
else
wget -q -O- "${repo}/${plugin}-${version}.ez" > "${plugins_dir}/${plugin}-${version}.ez"
fi
}
case $action in
install)
is_installed || install_plugin
;;
is_installed)
is_installed && exit 0 || exit 1
;;
*)
usage
;;
esac

View File

@ -45,7 +45,7 @@ python-amqp
python-cinder
python-devel.x86_64
python-virtualenv
rabbitmq-server
rabbitmq-server-2.8.7
rpm-build
rsyslog
ruby

View File

@ -1,5 +1,3 @@
http://www.rabbitmq.com/releases/plugins/v2.6.1/amqp_client-2.6.1.ez
http://www.rabbitmq.com/releases/plugins/v2.6.1/rabbitmq_stomp-2.6.1.ez
https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-uec.tar.gz
http://www.tcpdump.org/release/libpcap-1.3.0.tar.gz
http://pypcap.googlecode.com/files/pypcap-1.1.tar.gz