Showing with 66 additions and 9 deletions.
  1. +17 −0 CHANGELOG.md
  2. +9 −1 REFERENCE.md
  3. +2 −1 manifests/config.pp
  4. +13 −2 manifests/init.pp
  5. +2 −2 metadata.json
  6. +21 −1 spec/classes/rabbitmq_spec.rb
  7. +2 −2 templates/enabled_plugins.erb
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v12.1.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v12.1.0) (2023-02-11)

[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v12.0.2...v12.1.0)

**Implemented enhancements:**

- bump puppet/systemd to \< 5.0.0 [\#919](https://github.com/voxpupuli/puppet-rabbitmq/pull/919) ([jhoblitt](https://github.com/jhoblitt))
- Enable usage of custom list of plugins when using static config file [\#917](https://github.com/voxpupuli/puppet-rabbitmq/pull/917) ([enothen](https://github.com/enothen))

**Closed issues:**

- rabbitmq clustering status needs manual intervention if cluster partners aren't reachable at time of creation [\#130](https://github.com/voxpupuli/puppet-rabbitmq/issues/130)

**Merged pull requests:**

- docs: fix minor grammar & typo [\#921](https://github.com/voxpupuli/puppet-rabbitmq/pull/921) ([MindTooth](https://github.com/MindTooth))

## [v12.0.2](https://github.com/voxpupuli/puppet-rabbitmq/tree/v12.0.2) (2022-08-13)

[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v12.0.1...v12.0.2)
Expand Down
10 changes: 9 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ The following parameters are available in the `rabbitmq` class.
Data type: `Boolean`

If enabled sets up the management interface/plugin for RabbitMQ.
This also install the rabbitmqadmin command line tool.
This will also install the rabbitmqadmin command line tool.

Default value: `true`

Expand All @@ -220,6 +220,14 @@ replacing the use of the rabbitmqplugins provider to enable plugins.

Default value: `false`

##### `plugins`

Data type: `Array`

Additional list of plugins to start, or to add to /etc/rabbitmq/enabled_plugins, if use_config_file_for_plugins is enabled.

Default value: []

##### `auth_backends`

Data type: `Optional[Array]`
Expand Down
3 changes: 2 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$admin_enable = $rabbitmq::admin_enable
$management_enable = $rabbitmq::management_enable
$use_config_file_for_plugins = $rabbitmq::use_config_file_for_plugins
$plugins = $rabbitmq::plugins
$cluster_node_type = $rabbitmq::cluster_node_type
$cluster_nodes = $rabbitmq::cluster_nodes
$config = $rabbitmq::config
Expand Down Expand Up @@ -128,7 +129,7 @@
$proto_dist = 'inet6_tcp'
$ssl_path = ''
}
$ipv6_or_tls_env = ['SERVER_ADDITIONAL', 'CTL'].reduce( {}) |$memo, $item| {
$ipv6_or_tls_env = ['SERVER_ADDITIONAL', 'CTL'].reduce({}) |$memo, $item| {
$orig = $_environment_variables["RABBITMQ_${item}_ERL_ARGS"]
$munged = $orig ? {
# already quoted, keep quoting
Expand Down
15 changes: 13 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@
#
# @param admin_enable
# If enabled sets up the management interface/plugin for RabbitMQ.
# This also install the rabbitmqadmin command line tool.
# This will also install the rabbitmqadmin command line tool.
# @param management_enable
# If enabled sets up the management interface/plugin for RabbitMQ.
# NOTE: This does not install the rabbitmqadmin command line tool.
# @param use_config_file_for_plugins
# If enabled the /etc/rabbitmq/enabled_plugins config file is created,
# replacing the use of the rabbitmqplugins provider to enable plugins.
# @param plugins
# Additional list of plugins to start, or to add to /etc/rabbitmq/enabled_plugins, if use_config_file_for_plugins is enabled.
# @param auth_backends
# An array specifying authorization/authentication backend to use. Single quotes should be placed around array entries,
# ex. `['{foo, baz}', 'baz']` Defaults to [rabbit_auth_backend_internal], and if using LDAP defaults to [rabbit_auth_backend_internal,
Expand Down Expand Up @@ -345,6 +347,7 @@
Boolean $admin_enable = true,
Boolean $management_enable = false,
Boolean $use_config_file_for_plugins = false,
Array $plugins = [],
Hash $cluster = $rabbitmq::cluster,
Enum['ram', 'disc'] $cluster_node_type = 'disc',
Array $cluster_nodes = [],
Expand Down Expand Up @@ -508,7 +511,7 @@

unless $use_config_file_for_plugins {
# NOTE(hjensas): condition on $service_manage to keep current behaviour.
# The condition is likely not required because installiton of rabbitmqadmin
# The condition is likely not required because installation of rabbitmqadmin
# is no longer handled here.
# TODO: Remove the condition on $service_manage
if ($management_enable or $admin_enable) and $service_manage {
Expand Down Expand Up @@ -550,6 +553,14 @@
}
}
}
# Start anything else listed on the plugins array, if it was not started already by the other booleans
$plugins.each | $plugin | {
rabbitmq_plugin { $plugin:
ensure => present,
notify => Class['rabbitmq::service'],
provider => 'rabbitmqplugins',
}
}
}

if $admin_enable and $service_manage {
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-rabbitmq",
"version": "12.0.2",
"version": "12.1.0",
"author": "voxpupuli",
"summary": "Installs, configures, and manages RabbitMQ.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -66,7 +66,7 @@
},
{
"name": "puppet/systemd",
"version_requirement": ">= 2.10.0 < 4.0.0"
"version_requirement": ">= 2.10.0 < 5.0.0"
}
],
"tags": [
Expand Down
22 changes: 21 additions & 1 deletion spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@
end

context 'use config file for plugins' do
describe 'config_plugins_file: true' do
describe 'config_plugins_file: true and default list of enabled plugins' do
let :params do
{ use_config_file_for_plugins: true }
end
Expand All @@ -700,6 +700,26 @@
end
end

describe 'config_plugins_file: true and custom list of enabled plugins' do
let :params do
{
use_config_file_for_plugins: true,
admin_enable: false,
plugins: %w[rabbitmq_stomp rabbitmq_shovel rabbitmq_prometheus]
}
end

it 'does not use rabbitmqplugin provider' do
is_expected.not_to contain_rabbitmq_plugin('rabbitmq_stomp')
is_expected.not_to contain_rabbitmq_plugin('rabbitmq_shovel')
is_expected.not_to contain_rabbitmq_plugin('rabbitmq_prometheus')
end

it 'configures enabled_plugins' do
is_expected.to contain_file('enabled_plugins').with_content(%r{\[rabbitmq_stomp,rabbitmq_shovel,rabbitmq_prometheus\]\.})
end
end

describe 'with all plugins enabled admin_enable: false, manamgent_enable: true' do
let :params do
{
Expand Down
4 changes: 2 additions & 2 deletions templates/enabled_plugins.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% This file managed by Puppet
% Template Path: <%= @module_name %>/templates/enabled_plugins
<%- @_plugins = [] -%>
<%- @_plugins = @plugins -%>
<%- if @admin_enable or @management_enable -%>
<%- @_plugins << 'rabbitmq_management' -%>
<%- end -%>
Expand All @@ -16,4 +16,4 @@
<%- @_plugins << 'rabbitmq_shovel_management' -%>
<%- end -%>
<%- end -%>
[<%= @_plugins.join(',')%>].
[<%= (@_plugins.uniq).join(',')%>].