Add rabbitmq service class.

This class manages the rabbitmq package, configuration file for Stomp
and the running service.  I need to add two defined resource types to
manage the user accounts in RabbitMQ and install additional plugins.
This commit is contained in:
Jeff McCune 2011-03-22 10:39:23 -07:00
parent b182b5ac54
commit 63917a5294
4 changed files with 80 additions and 1 deletions

View File

@ -11,7 +11,38 @@
# Sample Usage: # Sample Usage:
# #
# [Remember: No empty lines between comments and class definition] # [Remember: No empty lines between comments and class definition]
class rabbitmq { class rabbitmq($config='UNSET') inherits rabbitmq::params {
if $config == 'UNSET' {
$config_real = template("${module_name}/rabbitmq.conf")
} else {
$config_real = $config
}
File {
owner => '0',
group => '0',
mode => '0644',
}
package { $packages:
ensure => $pkg_ensure,
notify => Service["${service}"],
before => File['rabbitmq.conf'],
}
file { 'rabbitmq.conf':
ensure => file,
path => '/etc/rabbitmq/rabbitmq.conf',
content => $config_real,
notify => Service["${service}"],
}
service { $service:
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
}
} }

View File

@ -0,0 +1,38 @@
# Class: rabbitmq::params
#
# This class provides parameters for the rabbitmq module.
#
# Jeff McCune <jeff@puppetlabs.com>
#
# The intention is to subclass this class to bring the variables into scope.
#
# Parameters:
#
# version: 2.3.1
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# class rabbitmq inherits rabbitmq::params { }
#
class rabbitmq::params(
$version = 'UNSET'
) {
# This is the RabbitMQ Server Version
if $version == 'UNSET' {
$version_real = '2.3.1-1'
$pkg_ensure = 'present'
} else {
$version_real = $version
$pkg_ensure = $version
}
$packages = [ 'rabbitmq-server' ]
$service = 'rabbitmq-server'
}

View File

@ -0,0 +1,2 @@
# This file managed by Puppet
SERVER_START_ARGS="-rabbit_stomp tcp_listeners [6163]"

View File

@ -0,0 +1,8 @@
node default {
class { 'rabbitmq':
config => template('rabbitmq/rabbitmq.conf'),
}
}