Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add RabbitMQ Plugin Support

These plugins are modeled using a defined resource type named
rabbitmq::plugin.  They notify the service and require the package.
However, this is not ideal since the defined type is establishing
relationships to the resources inside the rabbitmq class.

I plan to refactor rabbitmq into rabbitmq::service to address this
issue.  Then, I'll be able to use class level relationships.
  • Loading branch information...
commit 689cdce35909d89a55a0b6b004d4a1345020322e 1 parent f6b8fdd
Jeff McCune jeffmccune authored
BIN  files/plugins/amqp_client-2.3.1.ez
View
Binary file not shown
BIN  files/plugins/rabbit_stomp-2.3.1.ez
View
Binary file not shown
14 manifests/params.pp
View
@@ -24,15 +24,23 @@
# This is the RabbitMQ Server Version
if $version == 'UNSET' {
- $version_real = '2.3.1-1'
+ $version_real = '2.3.1'
$pkg_ensure = 'present'
} else {
$version_real = $version
$pkg_ensure = $version
}
- $packages = [ 'rabbitmq-server' ]
- $service = 'rabbitmq-server'
+ case $operatingsystem {
+ centos, redhat, oel: {
+ $packages = 'rabbitmq-server'
+ $service = 'rabbitmq-server'
+ $plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version_real}/plugins"
+ }
+ default: {
+ fail("operatingsystem $operatingsystem is not supported")
+ }
+ }
}
48 manifests/plugin.pp
View
@@ -0,0 +1,48 @@
+# Define: rabbitmq::plugin
+#
+# This defined resource type manages plugins for RabbitMQ
+#
+# Parameters:
+#
+# Actions:
+#
+# Requires:
+#
+# Sample Usage:
+#
+define rabbitmq::plugin(
+ $ensure='UNSET',
+ $source='UNSET'
+) {
+
+ $plugin_dir = $::rabbitmq::params::plugin_dir
+ $service = $::rabbitmq::params::service
+ $packages = $::rabbitmq::params::packages
+
+ if $source == 'UNSET' {
+ $source_real = "puppet:///modules/rabbitmq/plugins/${name}"
+ } else {
+ $source_real = $source
+ }
+
+ if $ensure == 'UNSET' {
+ $ensure_real = 'present'
+ } else {
+ if $ensure in [ 'present', 'absent' ] {
+ $ensure_real = $ensure
+ } else {
+ fail("ensure must be present or absent. Received: ${ensure}")
+ }
+ }
+
+ file { "${plugin_dir}/${name}":
+ ensure => $ensure_real,
+ source => $source_real,
+ owner => '0',
+ group => '0',
+ mode => '0644',
+ require => Package[$packages],
+ notify => Service[$service],
+ }
+
+}
0  manifests/service.pp
View
No changes.
7 tests/site.pp
View
@@ -1,8 +1,15 @@
node default {
+ $rabbitmq_plugins = [ 'amqp_client-2.3.1.ez', 'rabbit_stomp-2.3.1.ez' ]
+
class { 'rabbitmq':
config => template('rabbitmq/rabbitmq.conf'),
}
+ # Required for MCollective
+ rabbitmq::plugin { $rabbitmq_plugins:
+ ensure => present,
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.