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:
parent
b182b5ac54
commit
63917a5294
@ -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,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
38
deployment/puppet/rabbitmq/manifests/params.pp
Normal file
38
deployment/puppet/rabbitmq/manifests/params.pp
Normal 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'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
2
deployment/puppet/rabbitmq/templates/rabbitmq.conf
Normal file
2
deployment/puppet/rabbitmq/templates/rabbitmq.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# This file managed by Puppet
|
||||||
|
SERVER_START_ARGS="-rabbit_stomp tcp_listeners [6163]"
|
8
deployment/puppet/rabbitmq/tests/site.pp
Normal file
8
deployment/puppet/rabbitmq/tests/site.pp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
node default {
|
||||||
|
|
||||||
|
class { 'rabbitmq':
|
||||||
|
config => template('rabbitmq/rabbitmq.conf'),
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user