Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING: manage_repos is now repos_ensure (default false), version is now unused, switch to RabbitMQ's "packagecloud" repos #493

Merged
merged 2 commits into from
Aug 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 22 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ This module manages RabbitMQ (www.rabbitmq.com)
The rabbitmq module sets up rabbitmq and has a number of providers to manage
everything from vhosts to exchanges after setup.

This module has been tested against 2.7.1 and is known to not support
all features against earlier versions.
This module has been tested against 3.5.x and 3.6.x (as well as earlier
versions) and is known to not support all features against versions
prior to 2.7.1.

## Setup

Expand Down Expand Up @@ -60,23 +61,6 @@ class { '::rabbitmq':
}
```

Or such as offline installation from intranet or local mirrors:

```puppet
class { '::rabbitmq':
key_content => template('openstack/rabbit.pub.key'),
package_gpg_key => '/tmp/rabbit.pub.key',
}
```

And this one will use external package key source for any (apt/rpm) package provider:

```puppet
class { '::rabbitmq':
package_gpg_key => 'http://www.some_site.some_domain/some_key.pub.key',
}
```

### Environment Variables
To use RabbitMQ Environment Variables, use the parameters `environment_variables` e.g.:

Expand Down Expand Up @@ -295,7 +279,7 @@ defaultsof 60 seconds. Setting this to `0` will disable heartbeats.
####`key_content`

Uses content method for Debian OS family. Should be a template for apt::source
class. Overrides `package_gpg_key` behavior, if enabled. Undefined by default.
class. Undefined by default.

####`ldap_auth`

Expand Down Expand Up @@ -329,10 +313,6 @@ Numeric port for LDAP server.

Boolean, set to true to log LDAP auth.

####`manage_repos`

Boolean, whether or not to manage package repositories.

####`management_ip_address`

Will fall back to `node_ip_address` if not explicitly set; allows configuring
Expand Down Expand Up @@ -364,12 +344,10 @@ Use 0.0.0.0 to bind to all interfaces.
Determines the ensure state of the package. Set to installed by default, but could
be changed to latest.

####`package_gpg_key`
###`package_gpg_key`

RPM package GPG key to import. Uses source method. Should be a URL for Debian/RedHat
OS family, or a file name for RedHat OS family.
Set to http://www.rabbitmq.com/rabbitmq-signing-key-public.asc by default.
Note, that `key_content`, if specified, would override this parameter for Debian OS family.
This should generally be left as default. If using a package not signed by the
RabbitMQ signing key, you can use this parameter to override the expected key.

####`package_name`

Expand All @@ -379,24 +357,16 @@ The name of the package to install.

What provider to use to install the package.

####`package_source`

Where should the package be installed from?

On Debian- and Arch-based systems using the default package provider,
this parameter is ignored and the package is installed from the
rabbitmq repository, if enabled with manage_repo => true, or from the
system repository otherwise. If you want to use dpkg as the
package_provider, you must specify a local package_source.

####`plugin_dir`

Location of RabbitMQ plugins.

####`port`

The RabbitMQ port.

####`repos_ensure`

Ensure that a repo with the official (and newer) RabbitMQ package is configured,
along with its signing key. Defaults to false (use system packages). This does
*not* ensure that soft dependencies (like EPEL on RHEL systems) are present.

####`service_ensure`

The state of the service.
Expand Down Expand Up @@ -497,15 +467,6 @@ Integer, corresponds to recbuf in RabbitMQ `tcp_listen_options`

Integer, corresponds to sndbuf in RabbitMQ `tcp_listen_options`

####`version`

Sets the version to install.

On Debian- and Arch-based operating systems, the version parameter is
ignored and the latest version is installed from the rabbitmq
repository, if enabled with manage_repo => true, or from the system
repository otherwise.

####`wipe_db_on_cookie_change`

Boolean to determine if we should DESTROY AND DELETE the RabbitMQ database.
Expand Down Expand Up @@ -701,20 +662,24 @@ This module has been built on and tested against Puppet 3.x.

The module has been tested on:

* RedHat Enterprise Linux 5/6
* Debian 6/7
* CentOS 5/6
* RedHat Enterprise Linux 6/7
* Debian 7/8
* CentOS 6/7
* Ubuntu 12.04/14.04

Testing on other platforms has been light and cannot be guaranteed.
Support for EL / CentOS 5 is deprecated.

### Apt module compatibility

While this module supports both 1.x and 2.x versions of the puppetlabs-apt module, it does not support puppetlabs-apt 2.0.0 or 2.0.1.
While this module supports both 1.x and 2.x versions of the
puppetlabs-apt module, it does not support puppetlabs-apt 2.0.0 or
2.0.1.

### Module dependencies

If running CentOS/RHEL, and using the yum provider, ensure the epel repo is present.
If running CentOS/RHEL, ensure the epel repo, or another repo containing
a suitable Erlang version, is present.

To have a suitable erlang version installed on RedHat and Debian systems,
you have to install another puppet module from http://forge.puppetlabs.com/garethr/erlang with:
Expand Down
8 changes: 5 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
$management_ssl = $rabbitmq::management_ssl
$management_hostname = $rabbitmq::management_hostname
$node_ip_address = $rabbitmq::node_ip_address
$plugin_dir = $rabbitmq::plugin_dir
$rabbitmq_user = $rabbitmq::rabbitmq_user
$rabbitmq_group = $rabbitmq::rabbitmq_group
$rabbitmq_home = $rabbitmq::rabbitmq_home
Expand Down Expand Up @@ -118,8 +117,11 @@
}

# Get ranch (socket acceptor pool) availability,
# use init class variable for that since version from the fact comes too late.
$ranch = versioncmp($rabbitmq::version, '3.6') >= 0
# Now that we have to rely on the fact, this may cause some chicken / egg
# or idempotency problems
if $::rabbitmq_version {
$ranch = versioncmp($::rabbitmq_version, '3.6') >= 0
}

file { '/etc/rabbitmq':
ensure => directory,
Expand Down
80 changes: 19 additions & 61 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@
String $package_ensure = $rabbitmq::params::package_ensure,
String $package_gpg_key = $rabbitmq::params::package_gpg_key,
String $package_name = $rabbitmq::params::package_name,
Optional[String] $package_provider = $rabbitmq::params::package_provider,
$package_source = undef,
Optional[String] $package_source = undef,
Boolean $repos_ensure = $rabbitmq::params::repos_ensure,
$manage_repos = undef,
Stdlib::Absolutepath $plugin_dir = $rabbitmq::params::plugin_dir,
$rabbitmq_user = $rabbitmq::params::rabbitmq_user,
$rabbitmq_group = $rabbitmq::params::rabbitmq_group,
$rabbitmq_home = $rabbitmq::params::rabbitmq_home,
$port = $rabbitmq::params::port,
Integer $port = $rabbitmq::params::port,
Boolean $tcp_keepalive = $rabbitmq::params::tcp_keepalive,
Integer $tcp_backlog = $rabbitmq::params::tcp_backlog,
Optional[Integer] $tcp_sndbuf = undef,
Expand All @@ -59,8 +57,8 @@
Optional[String] $ssl_cert_password = undef,
$ssl_port = $rabbitmq::params::ssl_port,
Optional[String] $ssl_interface = undef,
$ssl_management_port = $rabbitmq::params::ssl_management_port,
$ssl_stomp_port = $rabbitmq::params::ssl_stomp_port,
Integer $ssl_management_port = $rabbitmq::params::ssl_management_port,
Integer $ssl_stomp_port = $rabbitmq::params::ssl_stomp_port,
$ssl_verify = $rabbitmq::params::ssl_verify,
$ssl_fail_if_no_peer_cert = $rabbitmq::params::ssl_fail_if_no_peer_cert,
Optional[Array] $ssl_versions = undef,
Expand All @@ -74,12 +72,12 @@
$ldap_port = $rabbitmq::params::ldap_port,
Boolean $ldap_log = $rabbitmq::params::ldap_log,
Hash $ldap_config_variables = $rabbitmq::params::ldap_config_variables,
$stomp_port = $rabbitmq::params::stomp_port,
Integer $stomp_port = $rabbitmq::params::stomp_port,
Boolean $stomp_ssl_only = $rabbitmq::params::stomp_ssl_only,
$version = $rabbitmq::params::version,
Optional[String] $version = undef,
Boolean $wipe_db_on_cookie_change = $rabbitmq::params::wipe_db_on_cookie_change,
$cluster_partition_handling = $rabbitmq::params::cluster_partition_handling,
$file_limit = $rabbitmq::params::file_limit,
Variant[Integer, String] $file_limit = $rabbitmq::params::file_limit,
Hash $environment_variables = $rabbitmq::params::environment_variables,
Hash $config_variables = $rabbitmq::params::config_variables,
Hash $config_kernel_variables = $rabbitmq::params::config_kernel_variables,
Expand All @@ -95,32 +93,11 @@

# Validate install parameters.
validate_re($package_apt_pin, '^(|\d+)$')
validate_re($version, '^\d+\.\d+\.\d+(-\d+)*$') # Allow 3 digits and optional -n postfix.
# Validate config parameters.
if ! is_integer($management_port) {
validate_re($management_port, '\d+')
}
if $port and ! is_integer($port) {
validate_re($port, '\d+')
}
if ! is_integer($stomp_port) {
validate_re($stomp_port, '\d+')
}

# using sprintf for conversion to string, because "${file_limit}" doesn't
# pass lint, despite being nicer
validate_re(sprintf('%s', $file_limit),
'^(\d+|-1|unlimited|infinity)$', '$file_limit must be a positive integer, \'-1\', \'unlimited\', or \'infinity\'.')
if ! is_integer($ssl_port) {
validate_re($ssl_port, '\d+')
}
if ! is_integer($ssl_management_port) {
validate_re($ssl_management_port, '\d+')
}
if ! is_integer($ssl_stomp_port) {
validate_re($ssl_stomp_port, '\d+')
}
validate_re($ldap_port, '\d+')

if $ssl_only and ! $ssl {
fail('$ssl_only => true requires that $ssl => true')
Expand All @@ -136,53 +113,34 @@
}
}

# This needs to happen here instead of params.pp because
# $package_source needs to override the constructed value in params.pp
if $package_source { # $package_source was specified by user so use that one
$real_package_source = $package_source
# NOTE(bogdando) do not enforce the source value for yum provider #MODULES-1631
} elsif $package_provider != 'yum' {
# package_source was not specified, so construct it, unless the provider is 'yum'
case $::osfamily {
'RedHat', 'SUSE': {
$base_version = regsubst($version,'^(.*)-\d$','\1')
$real_package_source = "http://www.rabbitmq.com/releases/rabbitmq-server/v${base_version}/rabbitmq-server-${version}.noarch.rpm"
}
'OpenBSD': {
# We just use the default OpenBSD package from a mirror
$real_package_source = undef
}
default: { # Archlinux and Debian
$real_package_source = undef
}
}
} else { # for yum provider, use the source as is
$real_package_source = $package_source
if $package_source != undef {
warning('$package_source is now deprecated. Please use yum installation or handle outside of this module.')
}

if $manage_repos != undef {
warning('$manage_repos is now deprecated. Please use $repos_ensure instead')
warning('$manage_repos is now deprecated. Please use $repos_ensure instead.')
}

if $manage_repos != false {
if $version != undef {
warning('$version is now deprecated, and will not have any effect. If you need to pin to a particular version, use $package_ensure')
}

if $repos_ensure {
case $::osfamily {
'RedHat', 'SUSE': {
include '::rabbitmq::repo::rhel'
$package_require = undef
'RedHat': {
class { '::rabbitmq::repo::rhel':
key_source => $package_gpg_key,
}
}
'Debian': {
class { '::rabbitmq::repo::apt' :
key_source => $package_gpg_key,
key_content => $key_content,
}
$package_require = Class['apt::update']
}
default: {
$package_require = undef
}
}
} else {
$package_require = undef
}

include '::rabbitmq::install'
Expand Down
19 changes: 4 additions & 15 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
# Class rabbitmq::install
# Ensures the rabbitmq-server exists
# Ensures that rabbitmq-server exists
class rabbitmq::install {

$package_ensure = $rabbitmq::package_ensure
$package_name = $rabbitmq::package_name
$package_provider = $rabbitmq::package_provider
$package_require = $rabbitmq::package_require
$package_source = $rabbitmq::real_package_source
$rabbitmq_group = $rabbitmq::rabbitmq_group

package { 'rabbitmq-server':
ensure => $package_ensure,
name => $package_name,
provider => $package_provider,
notify => Class['rabbitmq::service'],
require => $package_require,
}

if $package_source {
Package['rabbitmq-server'] {
source => $package_source,
}
ensure => $package_ensure,
name => $package_name,
notify => Class['rabbitmq::service'],
}

if $rabbitmq::environment_variables['MNESIA_BASE'] {
Expand Down
Loading