tested support for 2.7.1 plugins and updated documentation
This commit is contained in:
parent
fbf180804b
commit
4f7c4a7720
@ -65,3 +65,13 @@ rabbitmq_user_permissions { 'dan@myhost':
|
||||
write_permission => '.*',
|
||||
provider => 'rabbitmqctl',
|
||||
}
|
||||
|
||||
rabbitmq_plugin
|
||||
|
||||
- query all currently enabled plugins
|
||||
#>puppet resource rabbitmq_plugin
|
||||
|
||||
rabbitmq_plugin {'rabbitmq_stomp':
|
||||
ensure => present,
|
||||
provider => 'rabbitmqplugins',
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmq-plugins) do
|
||||
Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins) do
|
||||
|
||||
commands :rabbitmq-plugins => 'rabbitmq-plugins'
|
||||
commands :rabbitmqplugins => 'rabbitmq-plugins'
|
||||
defaultfor :feature => :posix
|
||||
|
||||
def self.instances
|
||||
rabbitmq-plugins('list -e').split(/\n/).map do |line|
|
||||
rabbitmqplugins('list', '-e').split(/\n/).map do |line|
|
||||
if line.split(/\s+/)[1] =~ /^(\S+)$/
|
||||
new(:name => $1)
|
||||
else
|
||||
@ -14,15 +14,15 @@ Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmq-plugins) do
|
||||
end
|
||||
|
||||
def create
|
||||
rabbitmq-plugins('enable', resource[:name])
|
||||
rabbitmqplugins('enable', resource[:name])
|
||||
end
|
||||
|
||||
def destroy
|
||||
rabbitmq-plugins('disable', resource[:name])
|
||||
rabbitmqplugins('disable', resource[:name])
|
||||
end
|
||||
|
||||
def exists?
|
||||
out = rabbitmq-plugins('list -e').split(/\n/).detect do |line|
|
||||
out = rabbitmqplugins('list', '-e').split(/\n/).detect do |line|
|
||||
line.split(/\s+/)[1].match(/^#{resource[:name]}$/)
|
||||
end
|
||||
end
|
@ -1,41 +0,0 @@
|
||||
# Define: rabbitmq::plugin
|
||||
#
|
||||
# This defined resource type manages plugins for RabbitMQ
|
||||
#
|
||||
# NOTE: It is reommended to use packages to manage plugins if at all
|
||||
# possible. There are packages for stomp and amqp available in the prosvc
|
||||
# repository at http://yum.puppetlabs.com/prosvc/
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
define rabbitmq::plugin( $ensure=present, $source='UNSET') {
|
||||
|
||||
$plugin_dir = $::rabbitmq::server::plugin_dir
|
||||
|
||||
if $source == 'UNSET' {
|
||||
$source_real = "puppet:///modules/rabbitmq/plugins/${name}"
|
||||
} else {
|
||||
validate_re($source, '^(/|puppet://)')
|
||||
$source_real = $source
|
||||
}
|
||||
|
||||
validate_re($ensure, '^(present|absent)$')
|
||||
$ensure_real = $ensure
|
||||
|
||||
file { "${plugin_dir}/${name}":
|
||||
ensure => $ensure_real,
|
||||
source => $source_real,
|
||||
owner => '0',
|
||||
group => '0',
|
||||
mode => '0644',
|
||||
require => Class['rabbitmq'],
|
||||
notify => Class['rabbitmq::service'],
|
||||
}
|
||||
|
||||
}
|
@ -9,9 +9,7 @@
|
||||
# [*package_name*] - name of rabbitmq package
|
||||
# [*service_name*] - name of rabbitmq service
|
||||
# [*service_ensure*] - desired ensure state for service
|
||||
# [*install_stomp*] - whether to install stomp (required for mcollective)
|
||||
# [*stomp_port*] - port stomp should be listening on
|
||||
# [*stomp_package*] - package name to install stomp
|
||||
# [*config*] - contents of config file
|
||||
# [*env_config*] - contents of env-config file
|
||||
# Requires:
|
||||
@ -29,15 +27,13 @@ class rabbitmq::server(
|
||||
$version = 'UNSET',
|
||||
$service_name = 'rabbitmq-server',
|
||||
$service_ensure = 'running',
|
||||
$install_stomp = false,
|
||||
$config_stomp = false,
|
||||
$stomp_port = '6163',
|
||||
$stomp_package = 'rabbitmq-plugin-stomp',
|
||||
$config='UNSET',
|
||||
$env_config='UNSET'
|
||||
) {
|
||||
|
||||
validate_bool($delete_guest_user, $install_stomp, $config_stomp)
|
||||
validate_bool($delete_guest_user, $config_stomp)
|
||||
validate_re($port, '\d+')
|
||||
validate_re($stomp_port, '\d+')
|
||||
|
||||
@ -66,15 +62,6 @@ class rabbitmq::server(
|
||||
notify => Class['rabbitmq::service'],
|
||||
}
|
||||
|
||||
if $install_stomp {
|
||||
package { $stomp_package:
|
||||
ensure => installed,
|
||||
notify => Class['rabbitmq::service'],
|
||||
before => File['rabbitmq.config'],
|
||||
}
|
||||
$config_stomp = true
|
||||
}
|
||||
|
||||
file { '/etc/rabbitmq':
|
||||
ensure => directory,
|
||||
owner => '0',
|
||||
|
@ -1,9 +1,11 @@
|
||||
$rabbitmq_plugins = [ 'amqp_client-2.3.1.ez', 'rabbit_stomp-2.3.1.ez' ]
|
||||
class { 'rabbitmq::server':
|
||||
install_stomp => true,
|
||||
config_stomp => true,
|
||||
}
|
||||
|
||||
rabbitmq::plugin { $rabbitmq_plugins:
|
||||
$rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
|
||||
|
||||
rabbitmq_plugin { $rabbitmq_plugins:
|
||||
ensure => present,
|
||||
require => Class['rabbitmq']
|
||||
require => Class['rabbitmq::server'],
|
||||
provider => 'rabbitmqplugins',
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
node default {
|
||||
|
||||
$rabbitmq_plugins = [ 'amqp_client-2.3.1.ez', 'rabbit_stomp-2.3.1.ez' ]
|
||||
$rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
|
||||
|
||||
class { 'rabbitmq::server':
|
||||
config => '[ {rabbit_stomp, [{tcp_listeners, [1234]} ]} ].',
|
||||
}
|
||||
|
||||
# Required for MCollective
|
||||
rabbitmq::plugin { $rabbitmq_plugins:
|
||||
rabbitmq_plugin { $rabbitmq_plugins:
|
||||
ensure => present,
|
||||
require => Class['rabbitmq::server'],
|
||||
provider => 'rabbitmqplugins',
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user