diff --git a/deployment/puppet/rabbitmq/README b/deployment/puppet/rabbitmq/README index 315c10633e..bc38879c24 100644 --- a/deployment/puppet/rabbitmq/README +++ b/deployment/puppet/rabbitmq/README @@ -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', +} diff --git a/deployment/puppet/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmq-plugins.rb b/deployment/puppet/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb similarity index 51% rename from deployment/puppet/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmq-plugins.rb rename to deployment/puppet/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb index e6149ab71f..5750a169e5 100644 --- a/deployment/puppet/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmq-plugins.rb +++ b/deployment/puppet/rabbitmq/lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb @@ -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 diff --git a/deployment/puppet/rabbitmq/manifests/plugin.pp b/deployment/puppet/rabbitmq/manifests/plugin.pp deleted file mode 100644 index a3ba39496f..0000000000 --- a/deployment/puppet/rabbitmq/manifests/plugin.pp +++ /dev/null @@ -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'], - } - -} diff --git a/deployment/puppet/rabbitmq/manifests/server.pp b/deployment/puppet/rabbitmq/manifests/server.pp index 9f8f98bcd6..ade0463345 100644 --- a/deployment/puppet/rabbitmq/manifests/server.pp +++ b/deployment/puppet/rabbitmq/manifests/server.pp @@ -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', diff --git a/deployment/puppet/rabbitmq/tests/plugin.pp b/deployment/puppet/rabbitmq/tests/plugin.pp index 01f2377580..77e07b8fea 100644 --- a/deployment/puppet/rabbitmq/tests/plugin.pp +++ b/deployment/puppet/rabbitmq/tests/plugin.pp @@ -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: - ensure => present, - require => Class['rabbitmq'] +$rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ] + +rabbitmq_plugin { $rabbitmq_plugins: + ensure => present, + require => Class['rabbitmq::server'], + provider => 'rabbitmqplugins', } diff --git a/deployment/puppet/rabbitmq/tests/site.pp b/deployment/puppet/rabbitmq/tests/site.pp index 2a405ed811..75ebcfed32 100644 --- a/deployment/puppet/rabbitmq/tests/site.pp +++ b/deployment/puppet/rabbitmq/tests/site.pp @@ -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: - ensure => present, + rabbitmq_plugin { $rabbitmq_plugins: + ensure => present, + require => Class['rabbitmq::server'], + provider => 'rabbitmqplugins', } - }