diff --git a/deployment/puppet/rabbitmq/manifests/init.pp b/deployment/puppet/rabbitmq/manifests/init.pp index 042c90bdb0..6d98ef5ee3 100644 --- a/deployment/puppet/rabbitmq/manifests/init.pp +++ b/deployment/puppet/rabbitmq/manifests/init.pp @@ -11,7 +11,38 @@ # Sample Usage: # # [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, + } } diff --git a/deployment/puppet/rabbitmq/manifests/params.pp b/deployment/puppet/rabbitmq/manifests/params.pp new file mode 100644 index 0000000000..ba1bde318c --- /dev/null +++ b/deployment/puppet/rabbitmq/manifests/params.pp @@ -0,0 +1,38 @@ +# Class: rabbitmq::params +# +# This class provides parameters for the rabbitmq module. +# +# Jeff McCune +# +# 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' + +} + diff --git a/deployment/puppet/rabbitmq/templates/rabbitmq.conf b/deployment/puppet/rabbitmq/templates/rabbitmq.conf new file mode 100644 index 0000000000..04d1f5f0f7 --- /dev/null +++ b/deployment/puppet/rabbitmq/templates/rabbitmq.conf @@ -0,0 +1,2 @@ +# This file managed by Puppet +SERVER_START_ARGS="-rabbit_stomp tcp_listeners [6163]" diff --git a/deployment/puppet/rabbitmq/tests/site.pp b/deployment/puppet/rabbitmq/tests/site.pp new file mode 100644 index 0000000000..7b86e22b86 --- /dev/null +++ b/deployment/puppet/rabbitmq/tests/site.pp @@ -0,0 +1,8 @@ +node default { + + class { 'rabbitmq': + config => template('rabbitmq/rabbitmq.conf'), + } + +} +