Skip to content

Commit

Permalink
Add RabbitMQ Plugin Support
Browse files Browse the repository at this point in the history
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
Jeff McCune committed Mar 22, 2011
1 parent f6b8fdd commit 689cdce
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 3 deletions.
Binary file added files/plugins/amqp_client-2.3.1.ez
Binary file not shown.
Binary file added files/plugins/rabbit_stomp-2.3.1.ez
Binary file not shown.
14 changes: 11 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 48 additions & 0 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
@@ -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],
}

}
Empty file added manifests/service.pp
Empty file.
7 changes: 7 additions & 0 deletions tests/site.pp
Original file line number Diff line number Diff line change
@@ -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,
}

}

0 comments on commit 689cdce

Please sign in to comment.