mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
Upgrade php from 5.4.* to 5.5.*
This commit is contained in:
9
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/.fixtures.yml
vendored
Normal file
9
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/.fixtures.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fixtures:
|
||||
repositories:
|
||||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
|
||||
"staging": "git://github.com/nanliu/puppet-staging.git"
|
||||
erlang:
|
||||
repo: "https://github.com/garethr/garethr-erlang.git"
|
||||
symlinks:
|
||||
"rabbitmq": "#{source_dir}"
|
35
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/.nodeset.yml
vendored
Normal file
35
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/.nodeset.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
default_set: 'centos-64-x64'
|
||||
sets:
|
||||
'centos-59-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'centos-59-x64'
|
||||
'centos-64-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'centos-64-x64'
|
||||
'fedora-18-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'fedora-18-x64'
|
||||
'debian-607-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'debian-607-x64'
|
||||
'debian-70rc1-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'debian-70rc1-x64'
|
||||
'ubuntu-server-10044-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'ubuntu-server-10044-x64'
|
||||
'ubuntu-server-12042-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'ubuntu-server-12042-x64'
|
||||
'sles-11sp1-x64':
|
||||
nodes:
|
||||
"main.foo.vm":
|
||||
prefab: 'sles-11sp1-x64'
|
38
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/.travis.yml
vendored
Normal file
38
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/.travis.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
language: ruby
|
||||
bundler_args: --without development
|
||||
script: bundle exec rake spec SPEC_OPTS='--format documentation'
|
||||
after_success:
|
||||
- git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-releng
|
||||
- .forge-releng/publish
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.3
|
||||
- 2.0.0
|
||||
- 2.1.1
|
||||
env:
|
||||
matrix:
|
||||
- PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.4.0"
|
||||
- PUPPET_GEM_VERSION="~> 3.5.0"
|
||||
global:
|
||||
- PUBLISHER_LOGIN=puppetlabs
|
||||
- secure: |-
|
||||
mSHk+9ReN6wxJ9sOgySOSKEjaXOdtT9B1BtvsOGcm/FQI3p57meid3B6z37r\nNv9PbxwGb
|
||||
mcZafMxNAfwr8nUb/bqxeXnZaGiY0E9pvg9aRr3g4knczn+siW+\nDkKlvM0rex2zzF0PDc
|
||||
495e61kP5cxcKNVdDJSiUPPK6fNGQ1xX8=
|
||||
matrix:
|
||||
exclude:
|
||||
- rvm: 1.9.3
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
|
||||
- rvm: 2.0.0
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
|
||||
- rvm: 2.1.1
|
||||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
|
||||
- rvm: 2.1.1
|
||||
env: PUPPET_GEM_VERSION="~> 3.4.0"
|
||||
notifications:
|
||||
email: false
|
115
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/CHANGELOG
vendored
Normal file
115
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/CHANGELOG
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
2014-05-16 - Version 4.0.0
|
||||
|
||||
Summary:
|
||||
|
||||
This release includes many new features and bug fixes. With the exception of
|
||||
erlang management this should be backwards compatible with 3.1.0.
|
||||
|
||||
Backwards-incompatible Changes:
|
||||
- erlang_manage was removed. You will need to manage erlang separately. See
|
||||
the README for more information on how to configure this.
|
||||
|
||||
Features:
|
||||
- Improved SSL support
|
||||
- Add LDAP support
|
||||
- Add ability to manage RabbitMQ repositories
|
||||
- Add ability to manage Erlang kernel configuration options
|
||||
- Improved handling of user tags
|
||||
- Use nanliu-staging module instead of hardcoded 'curl'
|
||||
- Switch to yum or zypper provider instead of rpm
|
||||
- Add ability to manage STOMP plugin installation.
|
||||
- Allow empty permission fields
|
||||
- Convert existing system tests to beaker acceptance tests.
|
||||
|
||||
Bugfixes:
|
||||
- exchanges no longer recreated on each puppet run if non-default vhost is used
|
||||
- Allow port to be UNSET
|
||||
- Re-added rabbitmq::server class
|
||||
- Deprecated previously unused manage_service variable in favor of
|
||||
service_manage
|
||||
- Use correct key for rabbitmq apt::source
|
||||
- config_mirrored_queues variable removed
|
||||
- It previously did nothing, will now at least throw a warning if you try to
|
||||
use it
|
||||
- Remove unnecessary dependency on Class['rabbitmq::repo::rhel'] in
|
||||
rabbitmq::install
|
||||
|
||||
|
||||
2013-09-14 - Version 3.1.0
|
||||
|
||||
Summary:
|
||||
|
||||
This release focuses on a few small (but critical) bugfixes as well as extends
|
||||
the amount of custom RabbitMQ configuration you can do with the module.
|
||||
|
||||
Features:
|
||||
- You can now change RabbitMQ 'Config Variables' via the parameter `config_variables`.
|
||||
- You can now change RabbitMQ 'Environment Variables' via the parameter `environment_variables`.
|
||||
- ArchLinux support added.
|
||||
|
||||
Fixes:
|
||||
- Make use of the user/password parameters in rabbitmq_exchange{}
|
||||
- Correct the read/write parameter order on set_permissions/list_permissions as
|
||||
they were reversed.
|
||||
- Make the module pull down 3.1.5 by default.
|
||||
|
||||
* 2013-07-18 3.0.0
|
||||
Summary:
|
||||
This release heavily refactors the RabbitMQ and changes functionality in
|
||||
several key ways. Please pay attention to the new README.md file for
|
||||
details of how to interact with the class now. Puppet 3 and RHEL are
|
||||
now fully supported. The default version of RabbitMQ has changed to
|
||||
a 3.x release.
|
||||
|
||||
Bugfixes:
|
||||
- Improve travis testing options.
|
||||
- Stop reimporting the GPG key on every run on RHEL and Debian.
|
||||
- Fix documentation to make it clear you don't have to set provider => each time.
|
||||
- Reference the standard rabbitmq port in the documentation instead of a custom port.
|
||||
- Fixes to the README formatting.
|
||||
|
||||
Features:
|
||||
- Refactor the module to fix RHEL support. All interaction with the module
|
||||
is now done through the main rabbitmq class.
|
||||
- Add support for mirrored queues (Only on Debian family distributions currently)
|
||||
- Add rabbitmq_exchange provider (using rabbitmqadmin)
|
||||
- Add new `rabbitmq` class parameters:
|
||||
- `manage_service`: Boolean to choose if Puppet should manage the service. (For pacemaker/HA setups)
|
||||
- Add SuSE support.
|
||||
|
||||
Incompatible Changes:
|
||||
- Rabbitmq::server has been removed and is now rabbitmq::config. You should
|
||||
not use this class directly, only via the main rabbitmq class.
|
||||
|
||||
* 2013-04-11 2.1.0
|
||||
- remove puppetversion from rabbitmq.config template
|
||||
- add cluster support
|
||||
- escape resource names in regexp
|
||||
|
||||
* 2012-07-31 Jeff McCune <jeff@puppetlabs.com> 2.0.2
|
||||
- Re-release 2.0.1 with $EDITOR droppings cleaned up
|
||||
|
||||
* 2012-05-03 2.0.0
|
||||
- added support for new-style admin users
|
||||
- added support for rabbitmq 2.7.1
|
||||
|
||||
* 2011-06-14 Dan Bode <dan@Puppetlabs.com> 2.0.0rc1
|
||||
- Massive refactor:
|
||||
- added native types for user/vhost/user_permissions
|
||||
- added apt support for vendor packages
|
||||
- added smoke tests
|
||||
|
||||
* 2011-04-08 Jeff McCune <jeff@puppetlabs.com> 1.0.4
|
||||
- Update module for RabbitMQ 2.4.1 and rabbitmq-plugin-stomp package.
|
||||
|
||||
2011-03-24 1.0.3
|
||||
- Initial release to the forge. Reviewed by Cody. Whitespace is good.
|
||||
|
||||
2011-03-22 1.0.2
|
||||
- Whitespace only fix again... ack '\t' is my friend...
|
||||
|
||||
2011-03-22 1.0.1
|
||||
- Whitespace only fix.
|
||||
|
||||
2011-03-22 1.0.0
|
||||
- Initial Release. Manage the package, file and service.
|
26
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/Gemfile
vendored
Normal file
26
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/Gemfile
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
group :development, :test do
|
||||
gem 'rake', '10.1.1', :require => false
|
||||
gem 'rspec-puppet', '>=1.0.0', :require => false
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'puppet-lint', :require => false
|
||||
gem 'serverspec', :require => false
|
||||
gem 'beaker', :require => false
|
||||
gem 'beaker-rspec', :require => false
|
||||
gem 'pry', :require => false
|
||||
end
|
||||
|
||||
if facterversion = ENV['FACTER_GEM_VERSION']
|
||||
gem 'facter', facterversion, :require => false
|
||||
else
|
||||
gem 'facter', :require => false
|
||||
end
|
||||
|
||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||
gem 'puppet', puppetversion, :require => false
|
||||
else
|
||||
gem 'puppet', :require => false
|
||||
end
|
||||
|
||||
# vim:ft=ruby
|
201
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/LICENSE
vendored
Normal file
201
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/LICENSE
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2013 Puppet Labs
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
13
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/Modulefile
vendored
Normal file
13
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/Modulefile
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
name 'puppetlabs-rabbitmq'
|
||||
version '4.0.0'
|
||||
source 'git://github.com/puppetlabs/puppetlabs-rabbitmq.git'
|
||||
author 'puppetlabs'
|
||||
license 'Apache'
|
||||
summary 'RabbitMQ Puppet Module'
|
||||
description 'This module manages RabbitMQ. Tested on Debian, Ubuntu, and RedHat'
|
||||
project_page 'http://github.com/puppetlabs/puppetlabs-rabbitmq'
|
||||
|
||||
## Add dependencies, if any:
|
||||
dependency 'puppetlabs/stdlib', '>= 2.0.0'
|
||||
dependency 'puppetlabs/apt', '>= 1.0.0'
|
||||
dependency 'nanliu/staging', '>= 0.3.1'
|
394
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/README.md
vendored
Normal file
394
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/README.md
vendored
Normal file
@@ -0,0 +1,394 @@
|
||||
#rabbitmq
|
||||
|
||||
####Table of Contents
|
||||
|
||||
1. [Overview](#overview)
|
||||
2. [Module Description - What the module does and why it is useful](#module-description)
|
||||
3. [Setup - The basics of getting started with rabbitmq](#setup)
|
||||
* [What rabbitmq affects](#what-rabbitmq-affects)
|
||||
* [Setup requirements](#setup-requirements)
|
||||
* [Beginning with rabbitmq](#beginning-with-rabbitmq)
|
||||
4. [Usage - Configuration options and additional functionality](#usage)
|
||||
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
|
||||
5. [Limitations - OS compatibility, etc.](#limitations)
|
||||
* [RedHat module dependencies](#redhat-module-dependecies)
|
||||
6. [Development - Guide for contributing to the module](#development)
|
||||
|
||||
##Overview
|
||||
|
||||
This module manages RabbitMQ (www.rabbitmq.com)
|
||||
|
||||
##Module Description
|
||||
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.
|
||||
|
||||
##Setup
|
||||
|
||||
###What rabbitmq affects
|
||||
|
||||
* rabbitmq repository files.
|
||||
* rabbitmq package.
|
||||
* rabbitmq configuration file.
|
||||
* rabbitmq service.
|
||||
|
||||
###Beginning with rabbitmq
|
||||
|
||||
```puppet
|
||||
include '::rabbitmq'
|
||||
```
|
||||
|
||||
##Usage
|
||||
|
||||
All options and configuration can be done through interacting with the parameters
|
||||
on the main rabbitmq class. These are documented below.
|
||||
|
||||
##rabbitmq class
|
||||
|
||||
To begin with the rabbitmq class controls the installation of rabbitmq. In here
|
||||
you can control many parameters relating to the package and service, such as
|
||||
disabling puppet support of the service:
|
||||
|
||||
```puppet
|
||||
class { '::rabbitmq':
|
||||
service_manage => false,
|
||||
port => '5672',
|
||||
delete_guest_user => true,
|
||||
}
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
To use RabbitMQ Environment Variables, use the parameters `environment_variables` e.g.:
|
||||
|
||||
```puppet
|
||||
class { 'rabbitmq':
|
||||
port => '5672',
|
||||
environment_variables => {
|
||||
'RABBITMQ_NODENAME' => 'node01',
|
||||
'RABBITMQ_SERVICENAME' => 'RabbitMQ'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Variables Configurable in rabbitmq.config
|
||||
To change RabbitMQ Config Variables in rabbitmq.config, use the parameters `config_variables` e.g.:
|
||||
|
||||
```puppet
|
||||
class { 'rabbitmq':
|
||||
port => '5672',
|
||||
config_variables => {
|
||||
'hipe_compile' => true,
|
||||
'frame_max' => 131072,
|
||||
'log_levels' => "[{connection, info}]"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To change Erlang Kernel Config Variables in rabbitmq.config, use the parameters
|
||||
`config_kernel_variables` e.g.:
|
||||
|
||||
```puppet
|
||||
class { 'rabbitmq':
|
||||
port => '5672',
|
||||
config_kernel_variables => {
|
||||
'inet_dist_listen_min' => 9100,
|
||||
'inet_dist_listen_max' => 9105,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Clustering
|
||||
To use RabbitMQ clustering facilities, use the rabbitmq parameters
|
||||
`config_cluster`, `cluster_nodes`, and `cluster_node_type`, e.g.:
|
||||
|
||||
```puppet
|
||||
class { 'rabbitmq':
|
||||
config_cluster => true,
|
||||
cluster_nodes => ['rabbit1', 'rabbit2'],
|
||||
cluster_node_type => 'ram',
|
||||
}
|
||||
```
|
||||
|
||||
**NOTE:** If you are using a version of RabbitMQ less than 3.0,
|
||||
you still need to use `x-ha-policy: all` in your client
|
||||
applications for any particular queue to take advantage of H/A via
|
||||
mirrored queues.
|
||||
|
||||
If you are using a version of RabbitMQ >= 3.0 You should set the
|
||||
'config_mirrored_queues' parameter if you plan
|
||||
on using RabbitMQ Mirrored Queues within your cluster:
|
||||
|
||||
```puppet
|
||||
class { 'rabbitmq':
|
||||
config_cluster => true,
|
||||
config_mirrored_queues => true,
|
||||
cluster_nodes => ['rabbit1', 'rabbit2'],
|
||||
}
|
||||
```
|
||||
|
||||
##Reference
|
||||
|
||||
##Classes
|
||||
|
||||
* rabbitmq: Main class for installation and service management.
|
||||
* rabbitmq::config: Main class for rabbitmq configuration/management.
|
||||
* rabbitmq::install: Handles package installation.
|
||||
* rabbitmq::params: Different configuration data for different systems.
|
||||
* rabbitmq::service: Handles the rabbitmq service.
|
||||
* rabbitmq::repo::apt: Handles apt repo for Debian systems.
|
||||
* rabbitmq::repo::rhel: Handles yum repo for Redhat systems.
|
||||
|
||||
###Parameters
|
||||
|
||||
####`admin_enable`
|
||||
|
||||
If enabled sets up the management interface/plugin for RabbitMQ.
|
||||
|
||||
####`cluster_disk_nodes`
|
||||
|
||||
DEPRECATED AND REPLACED BY CLUSTER_NODES.
|
||||
|
||||
####`cluster_node_type`
|
||||
|
||||
Choose between disk and ram nodes.
|
||||
|
||||
####`cluster_nodes`
|
||||
|
||||
An array of nodes for clustering.
|
||||
|
||||
####`config`
|
||||
|
||||
The file to use as the rabbitmq.config template.
|
||||
|
||||
####`config_cluster`
|
||||
|
||||
Boolean to enable or disable clustering support.
|
||||
|
||||
####`config_mirrored_queues`
|
||||
|
||||
DEPRECATED
|
||||
|
||||
Configuring queue mirroring should be done by setting the according policy for
|
||||
the queue. You can read more about it
|
||||
[here](http://www.rabbitmq.com/ha.html#genesis)
|
||||
|
||||
####`config_path`
|
||||
|
||||
The path to write the RabbitMQ configuration file to.
|
||||
|
||||
####`config_stomp`
|
||||
|
||||
Boolean to enable or disable stomp.
|
||||
|
||||
####`delete_guest_user`
|
||||
|
||||
Boolean to decide if we should delete the default guest user.
|
||||
|
||||
####`env_config`
|
||||
|
||||
The template file to use for rabbitmq_env.config.
|
||||
|
||||
####`env_config_path`
|
||||
|
||||
The path to write the rabbitmq_env.config file to.
|
||||
|
||||
####`erlang_cookie`
|
||||
|
||||
The erlang cookie to use for clustering - must be the same between all nodes.
|
||||
|
||||
####`config_variables`
|
||||
|
||||
To set config variables in rabbitmq.config
|
||||
|
||||
####`node_ip_address`
|
||||
|
||||
The value of RABBITMQ_NODE_IP_ADDRESS in rabbitmq_env.config
|
||||
|
||||
####`environment_variables`
|
||||
|
||||
RabbitMQ Environment Variables in rabbitmq_env.config
|
||||
|
||||
####`package_ensure`
|
||||
|
||||
Determines the ensure state of the package. Set to installed by default, but could
|
||||
be changed to latest.
|
||||
|
||||
####`package_name`
|
||||
|
||||
The name of the package to install.
|
||||
|
||||
####`package_provider`
|
||||
|
||||
What provider to use to install the package.
|
||||
|
||||
####`package_source`
|
||||
|
||||
Where should the package be installed from?
|
||||
|
||||
####`plugin_dir`
|
||||
|
||||
Location of RabbitMQ plugins.
|
||||
|
||||
####`port`
|
||||
|
||||
The RabbitMQ port.
|
||||
|
||||
####`management_port`
|
||||
|
||||
The port for the RabbitMQ management interface.
|
||||
|
||||
####`service_ensure`
|
||||
|
||||
The state of the service.
|
||||
|
||||
####`service_manage`
|
||||
|
||||
Determines if the service is managed.
|
||||
|
||||
####`service_name`
|
||||
|
||||
The name of the service to manage.
|
||||
|
||||
####`ssl`
|
||||
|
||||
Configures the service for using SSL.
|
||||
|
||||
####`ssl_only`
|
||||
|
||||
Configures the service to only use SSL. No cleartext TCP listeners will be created.
|
||||
Requires that ssl => true also.
|
||||
|
||||
####`stomp_port`
|
||||
|
||||
The port to use for Stomp.
|
||||
|
||||
####`stomp_ensure`
|
||||
|
||||
Boolean to install the stomp plugin.
|
||||
|
||||
####`wipe_db_on_cookie_change`
|
||||
|
||||
Boolean to determine if we should DESTROY AND DELETE the RabbitMQ database.
|
||||
|
||||
####`version`
|
||||
|
||||
Sets the version to install.
|
||||
|
||||
##Native Types
|
||||
|
||||
### rabbitmq\_user
|
||||
|
||||
query all current users: `$ puppet resource rabbitmq_user`
|
||||
|
||||
```
|
||||
rabbitmq_user { 'dan':
|
||||
admin => true,
|
||||
password => 'bar',
|
||||
}
|
||||
```
|
||||
Optional parameter tags will set further rabbitmq tags like monitoring, policymaker, etc.
|
||||
To set the administrator tag use admin-flag.
|
||||
```puppet
|
||||
rabbitmq_user { 'dan':
|
||||
admin => true,
|
||||
password => 'bar',
|
||||
tags => ['monitoring', 'tag1'],
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### rabbitmq\_vhost
|
||||
|
||||
query all current vhosts: `$ puppet resource rabbitmq_vhost`
|
||||
|
||||
```puppet
|
||||
rabbitmq_vhost { 'myhost':
|
||||
ensure => present,
|
||||
}
|
||||
```
|
||||
|
||||
### rabbitmq\_exchange
|
||||
|
||||
```puppet
|
||||
rabbitmq_exchange { 'myexchange@myhost':
|
||||
user => 'dan',
|
||||
password => 'bar',
|
||||
type => 'topic',
|
||||
ensure => present,
|
||||
}
|
||||
```
|
||||
|
||||
### rabbitmq\_user\_permissions
|
||||
|
||||
```puppet
|
||||
rabbitmq_user_permissions { 'dan@myhost':
|
||||
configure_permission => '.*',
|
||||
read_permission => '.*',
|
||||
write_permission => '.*',
|
||||
}
|
||||
```
|
||||
|
||||
### rabbitmq\_plugin
|
||||
|
||||
query all currently enabled plugins `$ puppet resource rabbitmq_plugin`
|
||||
|
||||
```puppet
|
||||
rabbitmq_plugin {'rabbitmq_stomp':
|
||||
ensure => present,
|
||||
}
|
||||
```
|
||||
|
||||
##Limitations
|
||||
|
||||
This module has been built on and tested against Puppet 2.7 and higher.
|
||||
|
||||
The module has been tested on:
|
||||
|
||||
* RedHat Enterprise Linux 5/6
|
||||
* Debian 6/7
|
||||
* CentOS 5/6
|
||||
* Ubuntu 12.04
|
||||
|
||||
Testing on other platforms has been light and cannot be guaranteed.
|
||||
|
||||
### Module dependencies
|
||||
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:
|
||||
|
||||
puppet module install garethr-erlang
|
||||
|
||||
This module handles the packages for erlang.
|
||||
To use the module, add the following snippet to your site.pp or an appropriate profile class:
|
||||
|
||||
For RedHat systems:
|
||||
|
||||
include 'erlang'
|
||||
class { 'erlang': epel_enable => true}
|
||||
|
||||
For Debian systems:
|
||||
|
||||
include 'erlang'
|
||||
package { 'erlang-base':
|
||||
ensure => 'latest',
|
||||
}
|
||||
|
||||
##Development
|
||||
|
||||
Puppet Labs modules on the Puppet Forge are open projects, and community
|
||||
contributions are essential for keeping them great. We can’t access the
|
||||
huge number of platforms and myriad of hardware, software, and deployment
|
||||
configurations that Puppet is intended to serve.
|
||||
|
||||
We want to keep it as easy as possible to contribute changes so that our
|
||||
modules work in your environment. There are a few guidelines that we need
|
||||
contributors to follow so that we can have a chance of keeping on top of things.
|
||||
|
||||
You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing)
|
||||
|
||||
### Authors
|
||||
* Jeff McCune <jeff@puppetlabs.com>
|
||||
* Dan Bode <dan@puppetlabs.com>
|
||||
* RPM/RHEL packages by Vincent Janelle <randomfrequency@gmail.com>
|
||||
* Puppetlabs Module Team
|
10
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/Rakefile
vendored
Normal file
10
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/Rakefile
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
|
||||
PuppetLint.configuration.fail_on_warnings
|
||||
PuppetLint.configuration.send('disable_80chars')
|
||||
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
||||
PuppetLint.configuration.send('disable_class_parameter_defaults')
|
||||
PuppetLint.configuration.send('disable_documentation')
|
||||
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
|
||||
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
|
10
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/TODO
vendored
Normal file
10
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/TODO
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
provider TODO -
|
||||
- password should be a property and not a param
|
||||
- what if we tried to log in as that user?
|
||||
- can permissions from list_user_permissions contain whitespace?
|
||||
- what about defaultfor :true?
|
||||
- prefetching for performance
|
||||
- rabbit plugin should require rabbitmq class
|
||||
- rabbitmq class should be renamed server??
|
||||
- service name should default to -server
|
||||
- cannot find stomp package
|
@@ -0,0 +1,22 @@
|
||||
Files
|
||||
=====
|
||||
|
||||
Puppet comes with both a client and server for copying files around. The file
|
||||
serving function is provided as part of the central Puppet daemon,
|
||||
puppetmasterd, and the client function is used through the source attribute of
|
||||
file objects. Learn more at
|
||||
http://projects.puppetlabs.com/projects/puppet/wiki/File_Serving_Configuration
|
||||
|
||||
You can use managed files like this:
|
||||
|
||||
class myclass {
|
||||
package { mypackage: ensure => latest }
|
||||
service { myservice: ensure => running }
|
||||
file { "/etc/myfile":
|
||||
source => "puppet://$servername/modules/mymodule/myfile"
|
||||
}
|
||||
}
|
||||
|
||||
The files are searched for in:
|
||||
|
||||
$modulepath/mymodule/files/myfile
|
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
# Fact: rabbitmq_erlang_cookie
|
||||
#
|
||||
# Purpose: To determine the current erlang cookie value.
|
||||
#
|
||||
# Resolution: Returns the cookie.
|
||||
Facter.add(:rabbitmq_erlang_cookie) do
|
||||
confine :osfamily => %w[Debian RedHat Suse]
|
||||
|
||||
setcode do
|
||||
if File.exists?('/var/lib/rabbitmq/.erlang.cookie')
|
||||
File.read('/var/lib/rabbitmq/.erlang.cookie')
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,89 @@
|
||||
require 'puppet'
|
||||
Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin) do
|
||||
|
||||
commands :rabbitmqctl => '/usr/sbin/rabbitmqctl'
|
||||
has_command(:rabbitmqadmin, '/usr/local/bin/rabbitmqadmin') do
|
||||
environment( { 'HOME' => '' })
|
||||
end
|
||||
defaultfor :feature => :posix
|
||||
|
||||
def should_vhost
|
||||
if @should_vhost
|
||||
@should_vhost
|
||||
else
|
||||
@should_vhost = resource[:name].split('@')[1]
|
||||
end
|
||||
end
|
||||
|
||||
def self.all_vhosts
|
||||
vhosts = []
|
||||
parse_command(rabbitmqctl('list_vhosts')).collect do |vhost|
|
||||
vhosts.push(vhost)
|
||||
end
|
||||
vhosts
|
||||
end
|
||||
|
||||
def self.all_exchanges(vhost)
|
||||
exchanges = []
|
||||
parse_command(rabbitmqctl('list_exchanges', '-p', vhost, 'name', 'type'))
|
||||
end
|
||||
|
||||
def self.parse_command(cmd_output)
|
||||
# first line is:
|
||||
# Listing exchanges/vhosts ...
|
||||
# while the last line is
|
||||
# ...done.
|
||||
#
|
||||
cmd_output.split(/\n/)[1..-2]
|
||||
end
|
||||
|
||||
def self.instances
|
||||
resources = []
|
||||
all_vhosts.each do |vhost|
|
||||
all_exchanges(vhost).collect do |line|
|
||||
name, type = line.split()
|
||||
if type.nil?
|
||||
# if name is empty, it will wrongly get the type's value.
|
||||
# This way type will get the correct value
|
||||
type = name
|
||||
name = ''
|
||||
end
|
||||
exchange = {
|
||||
:type => type,
|
||||
:ensure => :present,
|
||||
:name => "%s@%s" % [name, vhost],
|
||||
}
|
||||
resources << new(exchange) if exchange[:type]
|
||||
end
|
||||
end
|
||||
resources
|
||||
end
|
||||
|
||||
def self.prefetch(resources)
|
||||
packages = instances
|
||||
resources.keys.each do |name|
|
||||
if provider = packages.find{ |pkg| pkg.name == name }
|
||||
resources[name].provider = provider
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def exists?
|
||||
@property_hash[:ensure] == :present
|
||||
end
|
||||
|
||||
def create
|
||||
vhost_opt = should_vhost ? "--vhost=#{should_vhost}" : ''
|
||||
name = resource[:name].split('@')[0]
|
||||
rabbitmqadmin('declare', 'exchange', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", "name=#{name}", "type=#{resource[:type]}")
|
||||
@property_hash[:ensure] = :present
|
||||
end
|
||||
|
||||
def destroy
|
||||
vhost_opt = should_vhost ? "--vhost=#{should_vhost}" : ''
|
||||
name = resource[:name].split('@')[0]
|
||||
rabbitmqadmin('delete', 'exchange', vhost_opt, "--user=#{resource[:user]}", "--password=#{resource[:password]}", "name=#{name}")
|
||||
@property_hash[:ensure] = :absent
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,47 @@
|
||||
Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins) do
|
||||
|
||||
if Puppet::PUPPETVERSION.to_f < 3
|
||||
if Facter.value(:osfamily) == 'RedHat'
|
||||
commands :rabbitmqplugins => '/usr/lib/rabbitmq/bin/rabbitmq-plugins'
|
||||
else
|
||||
commands :rabbitmqplugins => 'rabbitmq-plugins'
|
||||
end
|
||||
else
|
||||
if Facter.value(:osfamily) == 'RedHat'
|
||||
has_command(:rabbitmqplugins, '/usr/lib/rabbitmq/bin/rabbitmq-plugins') do
|
||||
environment :HOME => "/tmp"
|
||||
end
|
||||
else
|
||||
has_command(:rabbitmqplugins, 'rabbitmq-plugins') do
|
||||
environment :HOME => "/tmp"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
defaultfor :feature => :posix
|
||||
|
||||
def self.instances
|
||||
rabbitmqplugins('list', '-E').split(/\n/).map do |line|
|
||||
if line.split(/\s+/)[1] =~ /^(\S+)$/
|
||||
new(:name => $1)
|
||||
else
|
||||
raise Puppet::Error, "Cannot parse invalid plugins line: #{line}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
rabbitmqplugins('enable', resource[:name])
|
||||
end
|
||||
|
||||
def destroy
|
||||
rabbitmqplugins('disable', resource[:name])
|
||||
end
|
||||
|
||||
def exists?
|
||||
rabbitmqplugins('list', '-E').split(/\n/).detect do |line|
|
||||
line.split(/\s+/)[1].match(/^#{resource[:name]}$/)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,98 @@
|
||||
require 'puppet'
|
||||
require 'set'
|
||||
Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do
|
||||
|
||||
if Puppet::PUPPETVERSION.to_f < 3
|
||||
commands :rabbitmqctl => 'rabbitmqctl'
|
||||
else
|
||||
has_command(:rabbitmqctl, 'rabbitmqctl') do
|
||||
environment :HOME => "/tmp"
|
||||
end
|
||||
end
|
||||
|
||||
defaultfor :feature => :posix
|
||||
|
||||
def self.instances
|
||||
rabbitmqctl('list_users').split(/\n/)[1..-2].collect do |line|
|
||||
if line =~ /^(\S+)(\s+\[.*?\]|)$/
|
||||
new(:name => $1)
|
||||
else
|
||||
raise Puppet::Error, "Cannot parse invalid user line: #{line}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
rabbitmqctl('add_user', resource[:name], resource[:password])
|
||||
if resource[:admin] == :true
|
||||
make_user_admin()
|
||||
end
|
||||
if !resource[:tags].nil?
|
||||
set_user_tags(resource[:tags])
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
rabbitmqctl('delete_user', resource[:name])
|
||||
end
|
||||
|
||||
def exists?
|
||||
rabbitmqctl('list_users').split(/\n/)[1..-2].detect do |line|
|
||||
line.match(/^#{Regexp.escape(resource[:name])}(\s+(\[.*?\]|\S+)|)$/)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def tags
|
||||
get_user_tags.entries.sort
|
||||
end
|
||||
|
||||
|
||||
def tags=(tags)
|
||||
if ! tags.nil?
|
||||
set_user_tags(tags)
|
||||
end
|
||||
end
|
||||
|
||||
def admin
|
||||
if usertags = get_user_tags
|
||||
(:true if usertags.include?('administrator')) || :false
|
||||
else
|
||||
raise Puppet::Error, "Could not match line '#{resource[:name]} (true|false)' from list_users (perhaps you are running on an older version of rabbitmq that does not support admin users?)"
|
||||
end
|
||||
end
|
||||
|
||||
def admin=(state)
|
||||
if state == :true
|
||||
make_user_admin()
|
||||
else
|
||||
usertags = get_user_tags
|
||||
usertags.delete('administrator')
|
||||
rabbitmqctl('set_user_tags', resource[:name], usertags.entries.sort)
|
||||
end
|
||||
end
|
||||
|
||||
def set_user_tags(tags)
|
||||
is_admin = get_user_tags().member?("administrator") \
|
||||
|| resource[:admin] == :true
|
||||
usertags = Set.new(tags)
|
||||
if is_admin
|
||||
usertags.add("administrator")
|
||||
end
|
||||
rabbitmqctl('set_user_tags', resource[:name], usertags.entries.sort)
|
||||
end
|
||||
|
||||
def make_user_admin
|
||||
usertags = get_user_tags
|
||||
usertags.add('administrator')
|
||||
rabbitmqctl('set_user_tags', resource[:name], usertags.entries.sort)
|
||||
end
|
||||
|
||||
private
|
||||
def get_user_tags
|
||||
match = rabbitmqctl('list_users').split(/\n/)[1..-2].collect do |line|
|
||||
line.match(/^#{Regexp.escape(resource[:name])}\s+\[(.*?)\]/)
|
||||
end.compact.first
|
||||
Set.new(match[1].split(/, /)) if match
|
||||
end
|
||||
end
|
@@ -0,0 +1,105 @@
|
||||
Puppet::Type.type(:rabbitmq_user_permissions).provide(:rabbitmqctl) do
|
||||
|
||||
if Puppet::PUPPETVERSION.to_f < 3
|
||||
commands :rabbitmqctl => 'rabbitmqctl'
|
||||
else
|
||||
has_command(:rabbitmqctl, 'rabbitmqctl') do
|
||||
environment :HOME => "/tmp"
|
||||
end
|
||||
end
|
||||
|
||||
defaultfor :feature=> :posix
|
||||
|
||||
# cache users permissions
|
||||
def self.users(name, vhost)
|
||||
@users = {} unless @users
|
||||
unless @users[name]
|
||||
@users[name] = {}
|
||||
rabbitmqctl('list_user_permissions', name).split(/\n/)[1..-2].each do |line|
|
||||
if line =~ /^(\S+)\s+(\S*)\s+(\S*)\s+(\S*)$/
|
||||
@users[name][$1] =
|
||||
{:configure => $2, :read => $4, :write => $3}
|
||||
else
|
||||
raise Puppet::Error, "cannot parse line from list_user_permissions:#{line}"
|
||||
end
|
||||
end
|
||||
end
|
||||
@users[name][vhost]
|
||||
end
|
||||
|
||||
def users(name, vhost)
|
||||
self.class.users(name, vhost)
|
||||
end
|
||||
|
||||
def should_user
|
||||
if @should_user
|
||||
@should_user
|
||||
else
|
||||
@should_user = resource[:name].split('@')[0]
|
||||
end
|
||||
end
|
||||
|
||||
def should_vhost
|
||||
if @should_vhost
|
||||
@should_vhost
|
||||
else
|
||||
@should_vhost = resource[:name].split('@')[1]
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
resource[:configure_permission] ||= "''"
|
||||
resource[:read_permission] ||= "''"
|
||||
resource[:write_permission] ||= "''"
|
||||
rabbitmqctl('set_permissions', '-p', should_vhost, should_user, resource[:configure_permission], resource[:write_permission], resource[:read_permission])
|
||||
end
|
||||
|
||||
def destroy
|
||||
rabbitmqctl('clear_permissions', '-p', should_vhost, should_user)
|
||||
end
|
||||
|
||||
# I am implementing prefetching in exists b/c I need to be sure
|
||||
# that the rabbitmq package is installed before I make this call.
|
||||
def exists?
|
||||
users(should_user, should_vhost)
|
||||
end
|
||||
|
||||
def configure_permission
|
||||
users(should_user, should_vhost)[:configure]
|
||||
end
|
||||
|
||||
def configure_permission=(perm)
|
||||
set_permissions
|
||||
end
|
||||
|
||||
def read_permission
|
||||
users(should_user, should_vhost)[:read]
|
||||
end
|
||||
|
||||
def read_permission=(perm)
|
||||
set_permissions
|
||||
end
|
||||
|
||||
def write_permission
|
||||
users(should_user, should_vhost)[:write]
|
||||
end
|
||||
|
||||
def write_permission=(perm)
|
||||
set_permissions
|
||||
end
|
||||
|
||||
# implement memoization so that we only call set_permissions once
|
||||
def set_permissions
|
||||
unless @permissions_set
|
||||
@permissions_set = true
|
||||
resource[:configure_permission] ||= configure_permission
|
||||
resource[:read_permission] ||= read_permission
|
||||
resource[:write_permission] ||= write_permission
|
||||
rabbitmqctl('set_permissions', '-p', should_vhost, should_user,
|
||||
resource[:configure_permission], resource[:write_permission],
|
||||
resource[:read_permission]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,35 @@
|
||||
Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl) do
|
||||
|
||||
if Puppet::PUPPETVERSION.to_f < 3
|
||||
commands :rabbitmqctl => 'rabbitmqctl'
|
||||
else
|
||||
has_command(:rabbitmqctl, 'rabbitmqctl') do
|
||||
environment :HOME => "/tmp"
|
||||
end
|
||||
end
|
||||
|
||||
def self.instances
|
||||
rabbitmqctl('list_vhosts').split(/\n/)[1..-2].map do |line|
|
||||
if line =~ /^(\S+)$/
|
||||
new(:name => $1)
|
||||
else
|
||||
raise Puppet::Error, "Cannot parse invalid user line: #{line}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
rabbitmqctl('add_vhost', resource[:name])
|
||||
end
|
||||
|
||||
def destroy
|
||||
rabbitmqctl('delete_vhost', resource[:name])
|
||||
end
|
||||
|
||||
def exists?
|
||||
out = rabbitmqctl('list_vhosts').split(/\n/)[1..-2].detect do |line|
|
||||
line.match(/^#{Regexp.escape(resource[:name])}$/)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,54 @@
|
||||
Puppet::Type.newtype(:rabbitmq_exchange) do
|
||||
desc 'Native type for managing rabbitmq exchanges'
|
||||
|
||||
ensurable do
|
||||
defaultto(:present)
|
||||
newvalue(:present) do
|
||||
provider.create
|
||||
end
|
||||
newvalue(:absent) do
|
||||
provider.destroy
|
||||
end
|
||||
end
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
desc 'Name of exchange'
|
||||
newvalues(/^\S*@\S+$/)
|
||||
end
|
||||
|
||||
newparam(:type) do
|
||||
desc 'Exchange type to be set *on creation*'
|
||||
newvalues(/^\S+$/)
|
||||
end
|
||||
|
||||
newparam(:user) do
|
||||
desc 'The user to use to connect to rabbitmq'
|
||||
defaultto('guest')
|
||||
newvalues(/^\S+$/)
|
||||
end
|
||||
|
||||
newparam(:password) do
|
||||
desc 'The password to use to connect to rabbitmq'
|
||||
defaultto('guest')
|
||||
newvalues(/\S+/)
|
||||
end
|
||||
|
||||
validate do
|
||||
if self[:ensure] == :present and self[:type].nil?
|
||||
raise ArgumentError, "must set type when creating exchange for #{self[:name]} whose type is #{self[:type]}"
|
||||
end
|
||||
end
|
||||
|
||||
autorequire(:rabbitmq_vhost) do
|
||||
[self[:name].split('@')[1]]
|
||||
end
|
||||
|
||||
autorequire(:rabbitmq_user) do
|
||||
[self[:user]]
|
||||
end
|
||||
|
||||
autorequire(:rabbitmq_user_permissions) do
|
||||
["#{self[:user]}@#{self[:name].split('@')[1]}"]
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,19 @@
|
||||
Puppet::Type.newtype(:rabbitmq_plugin) do
|
||||
desc 'manages rabbitmq plugins'
|
||||
|
||||
ensurable do
|
||||
defaultto(:present)
|
||||
newvalue(:present) do
|
||||
provider.create
|
||||
end
|
||||
newvalue(:absent) do
|
||||
provider.destroy
|
||||
end
|
||||
end
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
'name of the plugin to enable'
|
||||
newvalues(/^\S+$/)
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,46 @@
|
||||
Puppet::Type.newtype(:rabbitmq_user) do
|
||||
desc 'Native type for managing rabbitmq users'
|
||||
|
||||
ensurable do
|
||||
defaultto(:present)
|
||||
newvalue(:present) do
|
||||
provider.create
|
||||
end
|
||||
newvalue(:absent) do
|
||||
provider.destroy
|
||||
end
|
||||
end
|
||||
|
||||
autorequire(:service) { 'rabbitmq-server' }
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
desc 'Name of user'
|
||||
newvalues(/^\S+$/)
|
||||
end
|
||||
|
||||
# newproperty(:password) do
|
||||
newparam(:password) do
|
||||
desc 'User password to be set *on creation*'
|
||||
end
|
||||
|
||||
newproperty(:admin) do
|
||||
desc 'rather or not user should be an admin'
|
||||
newvalues(/true|false/)
|
||||
munge do |value|
|
||||
# converting to_s incase its a boolean
|
||||
value.to_s.to_sym
|
||||
end
|
||||
defaultto :false
|
||||
end
|
||||
|
||||
newproperty(:tags, :array_matching => :all) do
|
||||
desc 'additional tags for the user'
|
||||
end
|
||||
|
||||
validate do
|
||||
if self[:ensure] == :present and ! self[:password]
|
||||
raise ArgumentError, 'must set password when creating user' unless self[:password]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,59 @@
|
||||
Puppet::Type.newtype(:rabbitmq_user_permissions) do
|
||||
desc 'Type for managing rabbitmq user permissions'
|
||||
|
||||
ensurable do
|
||||
defaultto(:present)
|
||||
newvalue(:present) do
|
||||
provider.create
|
||||
end
|
||||
newvalue(:absent) do
|
||||
provider.destroy
|
||||
end
|
||||
end
|
||||
|
||||
autorequire(:service) { 'rabbitmq-server' }
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
desc 'combination of user@vhost to grant privileges to'
|
||||
newvalues(/^\S+@\S+$/)
|
||||
end
|
||||
|
||||
newproperty(:configure_permission) do
|
||||
desc 'regexp representing configuration permissions'
|
||||
validate do |value|
|
||||
resource.validate_permissions(value)
|
||||
end
|
||||
end
|
||||
|
||||
newproperty(:read_permission) do
|
||||
desc 'regexp representing read permissions'
|
||||
validate do |value|
|
||||
resource.validate_permissions(value)
|
||||
end
|
||||
end
|
||||
|
||||
newproperty(:write_permission) do
|
||||
desc 'regexp representing write permissions'
|
||||
validate do |value|
|
||||
resource.validate_permissions(value)
|
||||
end
|
||||
end
|
||||
|
||||
autorequire(:rabbitmq_vhost) do
|
||||
[self[:name].split('@')[1]]
|
||||
end
|
||||
|
||||
autorequire(:rabbitmq_user) do
|
||||
[self[:name].split('@')[0]]
|
||||
end
|
||||
|
||||
# I may want to dissalow whitespace
|
||||
def validate_permissions(value)
|
||||
begin
|
||||
Regexp.new(value)
|
||||
rescue RegexpError
|
||||
raise ArgumentError, "Invalid regexp #{value}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,19 @@
|
||||
Puppet::Type.newtype(:rabbitmq_vhost) do
|
||||
desc 'manages rabbitmq vhosts'
|
||||
|
||||
ensurable do
|
||||
defaultto(:present)
|
||||
newvalue(:present) do
|
||||
provider.create
|
||||
end
|
||||
newvalue(:absent) do
|
||||
provider.destroy
|
||||
end
|
||||
end
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
'name of the vhost to add'
|
||||
newvalues(/^\S+$/)
|
||||
end
|
||||
|
||||
end
|
121
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/config.pp
vendored
Normal file
121
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/config.pp
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
class rabbitmq::config {
|
||||
|
||||
$cluster_disk_nodes = $rabbitmq::cluster_disk_nodes
|
||||
$cluster_node_type = $rabbitmq::cluster_node_type
|
||||
$cluster_nodes = $rabbitmq::cluster_nodes
|
||||
$config = $rabbitmq::config
|
||||
$config_cluster = $rabbitmq::config_cluster
|
||||
$config_path = $rabbitmq::config_path
|
||||
$config_stomp = $rabbitmq::config_stomp
|
||||
$default_user = $rabbitmq::default_user
|
||||
$default_pass = $rabbitmq::default_pass
|
||||
$env_config = $rabbitmq::env_config
|
||||
$env_config_path = $rabbitmq::env_config_path
|
||||
$erlang_cookie = $rabbitmq::erlang_cookie
|
||||
$node_ip_address = $rabbitmq::node_ip_address
|
||||
$plugin_dir = $rabbitmq::plugin_dir
|
||||
$port = $rabbitmq::port
|
||||
$service_name = $rabbitmq::service_name
|
||||
$ssl = $rabbitmq::ssl
|
||||
$ssl_only = $rabbitmq::ssl_only
|
||||
$ssl_cacert = $rabbitmq::ssl_cacert
|
||||
$ssl_cert = $rabbitmq::ssl_cert
|
||||
$ssl_key = $rabbitmq::ssl_key
|
||||
$ssl_management_port = $rabbitmq::ssl_management_port
|
||||
$ssl_stomp_port = $rabbitmq::ssl_stomp_port
|
||||
$ssl_verify = $rabbitmq::ssl_verify
|
||||
$ssl_fail_if_no_peer_cert = $rabbitmq::ssl_fail_if_no_peer_cert
|
||||
$stomp_port = $rabbitmq::stomp_port
|
||||
$wipe_db_on_cookie_change = $rabbitmq::wipe_db_on_cookie_change
|
||||
$config_variables = $rabbitmq::config_variables
|
||||
$config_kernel_variables = $rabbitmq::config_kernel_variables
|
||||
$cluster_partition_handling = $rabbitmq::cluster_partition_handling
|
||||
$default_env_variables = {
|
||||
'RABBITMQ_NODE_PORT' => $port,
|
||||
'RABBITMQ_NODE_IP_ADDRESS' => $node_ip_address
|
||||
}
|
||||
|
||||
# Handle env variables.
|
||||
$environment_variables = merge($default_env_variables, $rabbitmq::environment_variables)
|
||||
|
||||
# Handle deprecated option.
|
||||
if $cluster_disk_nodes != [] {
|
||||
notify { 'cluster_disk_nodes':
|
||||
message => 'WARNING: The cluster_disk_nodes is deprecated.
|
||||
Use cluster_nodes instead.',
|
||||
}
|
||||
$r_cluster_nodes = $cluster_disk_nodes
|
||||
} else {
|
||||
$r_cluster_nodes = $cluster_nodes
|
||||
}
|
||||
|
||||
file { '/etc/rabbitmq':
|
||||
ensure => directory,
|
||||
owner => '0',
|
||||
group => '0',
|
||||
mode => '0644',
|
||||
}
|
||||
|
||||
file { '/etc/rabbitmq/ssl':
|
||||
ensure => directory,
|
||||
owner => '0',
|
||||
group => '0',
|
||||
mode => '0644',
|
||||
}
|
||||
|
||||
file { 'rabbitmq.config':
|
||||
ensure => file,
|
||||
path => $config_path,
|
||||
content => template($config),
|
||||
owner => '0',
|
||||
group => '0',
|
||||
mode => '0644',
|
||||
notify => Class['rabbitmq::service'],
|
||||
}
|
||||
|
||||
file { 'rabbitmq-env.config':
|
||||
ensure => file,
|
||||
path => $env_config_path,
|
||||
content => template($env_config),
|
||||
owner => '0',
|
||||
group => '0',
|
||||
mode => '0644',
|
||||
notify => Class['rabbitmq::service'],
|
||||
}
|
||||
|
||||
|
||||
if $config_cluster {
|
||||
|
||||
file { 'erlang_cookie':
|
||||
ensure => 'present',
|
||||
path => '/var/lib/rabbitmq/.erlang.cookie',
|
||||
owner => 'rabbitmq',
|
||||
group => 'rabbitmq',
|
||||
mode => '0400',
|
||||
content => $erlang_cookie,
|
||||
replace => true,
|
||||
before => File['rabbitmq.config'],
|
||||
notify => Class['rabbitmq::service'],
|
||||
}
|
||||
|
||||
# rabbitmq_erlang_cookie is a fact in this module.
|
||||
if $erlang_cookie != $::rabbitmq_erlang_cookie {
|
||||
# Safety check.
|
||||
if $wipe_db_on_cookie_change {
|
||||
exec { 'wipe_db':
|
||||
command => "puppet resource service ${service_name} ensure=stopped; rm -rf /var/lib/rabbitmq/mnesia",
|
||||
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin',
|
||||
}
|
||||
File['erlang_cookie'] {
|
||||
require => Exec['wipe_db'],
|
||||
}
|
||||
} else {
|
||||
fail("ERROR: The current erlang cookie is ${::rabbitmq_erlang_cookie} and needs to change to ${erlang_cookie}. In order to do this the RabbitMQ database needs to be wiped. Please set the parameter called wipe_db_on_cookie_change to true to allow this to happen automatically.")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
176
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/init.pp
vendored
Normal file
176
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/init.pp
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
#
|
||||
class rabbitmq(
|
||||
$admin_enable = $rabbitmq::params::admin_enable,
|
||||
$cluster_disk_nodes = $rabbitmq::params::cluster_disk_nodes,
|
||||
$cluster_node_type = $rabbitmq::params::cluster_node_type,
|
||||
$cluster_nodes = $rabbitmq::params::cluster_nodes,
|
||||
$config = $rabbitmq::params::config,
|
||||
$config_cluster = $rabbitmq::params::config_cluster,
|
||||
$config_mirrored_queues = $rabbitmq::params::config_mirrored_queues,
|
||||
$config_path = $rabbitmq::params::config_path,
|
||||
$config_stomp = $rabbitmq::params::config_stomp,
|
||||
$default_user = $rabbitmq::params::default_user,
|
||||
$default_pass = $rabbitmq::params::default_pass,
|
||||
$delete_guest_user = $rabbitmq::params::delete_guest_user,
|
||||
$env_config = $rabbitmq::params::env_config,
|
||||
$env_config_path = $rabbitmq::params::env_config_path,
|
||||
$erlang_cookie = $rabbitmq::params::erlang_cookie,
|
||||
$management_port = $rabbitmq::params::management_port,
|
||||
$node_ip_address = $rabbitmq::params::node_ip_address,
|
||||
$package_apt_pin = $rabbitmq::params::package_apt_pin,
|
||||
$package_ensure = $rabbitmq::params::package_ensure,
|
||||
$package_gpg_key = $rabbitmq::params::package_gpg_key,
|
||||
$package_name = $rabbitmq::params::package_name,
|
||||
$package_provider = $rabbitmq::params::package_provider,
|
||||
$package_source = $rabbitmq::params::package_source,
|
||||
$manage_repos = $rabbitmq::params::manage_repos,
|
||||
$plugin_dir = $rabbitmq::params::plugin_dir,
|
||||
$port = $rabbitmq::params::port,
|
||||
$service_ensure = $rabbitmq::params::service_ensure,
|
||||
$service_manage = $rabbitmq::params::service_manage,
|
||||
$service_name = $rabbitmq::params::service_name,
|
||||
$ssl = $rabbitmq::params::ssl,
|
||||
$ssl_only = $rabbitmq::params::ssl_only,
|
||||
$ssl_cacert = $rabbitmq::params::ssl_cacert,
|
||||
$ssl_cert = $rabbitmq::params::ssl_cert,
|
||||
$ssl_key = $rabbitmq::params::ssl_key,
|
||||
$ssl_management_port = $rabbitmq::params::ssl_management_port,
|
||||
$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,
|
||||
$stomp_ensure = $rabbitmq::params::stomp_ensure,
|
||||
$ldap_auth = $rabbitmq::params::ldap_auth,
|
||||
$ldap_server = $rabbitmq::params::ldap_server,
|
||||
$ldap_user_dn_pattern = $rabbitmq::params::ldap_user_dn_pattern,
|
||||
$ldap_use_ssl = $rabbitmq::params::ldap_use_ssl,
|
||||
$ldap_port = $rabbitmq::params::ldap_port,
|
||||
$ldap_log = $rabbitmq::params::ldap_log,
|
||||
$stomp_port = $rabbitmq::params::stomp_port,
|
||||
$version = $rabbitmq::params::version,
|
||||
$wipe_db_on_cookie_change = $rabbitmq::params::wipe_db_on_cookie_change,
|
||||
$cluster_partition_handling = $rabbitmq::params::cluster_partition_handling,
|
||||
$environment_variables = $rabbitmq::params::environment_variables,
|
||||
$config_variables = $rabbitmq::params::config_variables,
|
||||
$config_kernel_variables = $rabbitmq::params::config_kernel_variables,
|
||||
) inherits rabbitmq::params {
|
||||
|
||||
validate_bool($admin_enable)
|
||||
# Validate install parameters.
|
||||
validate_re($package_apt_pin, '^(|\d+)$')
|
||||
validate_string($package_ensure)
|
||||
validate_string($package_gpg_key)
|
||||
validate_string($package_name)
|
||||
validate_string($package_provider)
|
||||
validate_bool($manage_repos)
|
||||
validate_re($version, '^\d+\.\d+\.\d+(-\d+)*$') # Allow 3 digits and optional -n postfix.
|
||||
# Validate config parameters.
|
||||
validate_array($cluster_disk_nodes)
|
||||
validate_re($cluster_node_type, '^(ram|disc)$')
|
||||
validate_array($cluster_nodes)
|
||||
validate_string($config)
|
||||
validate_absolute_path($config_path)
|
||||
validate_bool($config_cluster)
|
||||
validate_bool($config_mirrored_queues)
|
||||
validate_bool($config_stomp)
|
||||
validate_string($default_user)
|
||||
validate_string($default_pass)
|
||||
validate_bool($delete_guest_user)
|
||||
validate_string($env_config)
|
||||
validate_absolute_path($env_config_path)
|
||||
validate_string($erlang_cookie)
|
||||
validate_re($management_port, '\d+')
|
||||
validate_string($node_ip_address)
|
||||
validate_absolute_path($plugin_dir)
|
||||
validate_re($port, ['\d+','UNSET'])
|
||||
validate_re($stomp_port, '\d+')
|
||||
validate_bool($wipe_db_on_cookie_change)
|
||||
# Validate service parameters.
|
||||
validate_re($service_ensure, '^(running|stopped)$')
|
||||
validate_bool($service_manage)
|
||||
validate_string($service_name)
|
||||
validate_bool($ssl)
|
||||
validate_bool($ssl_only)
|
||||
validate_string($ssl_cacert)
|
||||
validate_string($ssl_cert)
|
||||
validate_string($ssl_key)
|
||||
validate_string($ssl_management_port)
|
||||
validate_re($ssl_management_port, '\d+')
|
||||
validate_string($ssl_stomp_port)
|
||||
validate_re($ssl_stomp_port, '\d+')
|
||||
validate_bool($stomp_ensure)
|
||||
validate_bool($ldap_auth)
|
||||
validate_string($ldap_server)
|
||||
validate_string($ldap_user_dn_pattern)
|
||||
validate_bool($ldap_use_ssl)
|
||||
validate_re($ldap_port, '\d+')
|
||||
validate_bool($ldap_log)
|
||||
validate_hash($environment_variables)
|
||||
validate_hash($config_variables)
|
||||
validate_hash($config_kernel_variables)
|
||||
|
||||
if $ssl_only and ! $ssl {
|
||||
fail('$ssl_only => true requires that $ssl => true')
|
||||
}
|
||||
|
||||
include '::rabbitmq::install'
|
||||
include '::rabbitmq::config'
|
||||
include '::rabbitmq::service'
|
||||
include '::rabbitmq::management'
|
||||
|
||||
if $rabbitmq::manage_repos == true {
|
||||
case $::osfamily {
|
||||
'RedHat', 'SUSE':
|
||||
{ include '::rabbitmq::repo::rhel' }
|
||||
'Debian':
|
||||
{ include '::rabbitmq::repo::apt' }
|
||||
default:
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
if $admin_enable and $service_manage {
|
||||
include '::rabbitmq::install::rabbitmqadmin'
|
||||
|
||||
rabbitmq_plugin { 'rabbitmq_management':
|
||||
ensure => present,
|
||||
require => Class['rabbitmq::install'],
|
||||
notify => Class['rabbitmq::service'],
|
||||
provider => 'rabbitmqplugins'
|
||||
}
|
||||
|
||||
Class['::rabbitmq::service'] -> Class['::rabbitmq::install::rabbitmqadmin']
|
||||
}
|
||||
|
||||
if $stomp_ensure {
|
||||
rabbitmq_plugin { 'rabbitmq_stomp':
|
||||
ensure => $stomp_ensure,
|
||||
require => Class['rabbitmq::install'],
|
||||
notify => Class['rabbitmq::service'],
|
||||
provider => 'rabbitmqplugins'
|
||||
}
|
||||
}
|
||||
|
||||
if ($ldap_auth) {
|
||||
rabbitmq_plugin { 'rabbitmq_auth_backend_ldap':
|
||||
ensure => present,
|
||||
require => Class['rabbitmq::install'],
|
||||
notify => Class['rabbitmq::service'],
|
||||
provider => 'rabbitmqplugins',
|
||||
}
|
||||
}
|
||||
|
||||
# Anchor this as per #8040 - this ensures that classes won't float off and
|
||||
# mess everything up. You can read about this at:
|
||||
# http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues
|
||||
anchor { 'rabbitmq::begin': }
|
||||
anchor { 'rabbitmq::end': }
|
||||
|
||||
Anchor['rabbitmq::begin'] -> Class['::rabbitmq::install']
|
||||
-> Class['::rabbitmq::config'] ~> Class['::rabbitmq::service']
|
||||
-> Class['::rabbitmq::management'] -> Anchor['rabbitmq::end']
|
||||
|
||||
# Make sure the various providers have their requirements in place.
|
||||
Class['::rabbitmq::install'] -> Rabbitmq_plugin<| |>
|
||||
Class['::rabbitmq::install::rabbitmqadmin'] -> Rabbitmq_exchange<| |>
|
||||
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
class rabbitmq::install {
|
||||
|
||||
$package_ensure = $rabbitmq::package_ensure
|
||||
$package_name = $rabbitmq::package_name
|
||||
$package_provider = $rabbitmq::package_provider
|
||||
$package_source = $rabbitmq::package_source
|
||||
|
||||
package { 'rabbitmq-server':
|
||||
ensure => $package_ensure,
|
||||
name => $package_name,
|
||||
provider => $package_provider,
|
||||
notify => Class['rabbitmq::service'],
|
||||
}
|
||||
|
||||
if $package_source {
|
||||
Package['rabbitmq-server'] {
|
||||
source => $package_source,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
#
|
||||
class rabbitmq::install::rabbitmqadmin {
|
||||
|
||||
$management_port = $rabbitmq::management_port
|
||||
|
||||
staging::file { 'rabbitmqadmin':
|
||||
target => '/var/lib/rabbitmq/rabbitmqadmin',
|
||||
source => "http://localhost:${management_port}/cli/rabbitmqadmin",
|
||||
require => [
|
||||
Class['rabbitmq::service'],
|
||||
Rabbitmq_plugin['rabbitmq_management']
|
||||
],
|
||||
}
|
||||
|
||||
file { '/usr/local/bin/rabbitmqadmin':
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
source => '/var/lib/rabbitmq/rabbitmqadmin',
|
||||
mode => '0755',
|
||||
require => Staging::File['rabbitmqadmin'],
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
#
|
||||
class rabbitmq::management {
|
||||
|
||||
$delete_guest_user = $rabbitmq::delete_guest_user
|
||||
|
||||
if $delete_guest_user {
|
||||
rabbitmq_user{ 'guest':
|
||||
ensure => absent,
|
||||
provider => 'rabbitmqctl',
|
||||
}
|
||||
}
|
||||
|
||||
if $rabbitmq::config_mirrored_queues {
|
||||
rabbitmq::policy { 'ha-all':
|
||||
pattern => '.*',
|
||||
definition => '{"ha-mode":"all","ha-sync-mode":"automatic"}'
|
||||
}
|
||||
}
|
||||
}
|
98
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/params.pp
vendored
Normal file
98
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/params.pp
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
# Class: rabbitmq::params
|
||||
#
|
||||
# The RabbitMQ Module configuration settings.
|
||||
#
|
||||
class rabbitmq::params {
|
||||
|
||||
case $::osfamily {
|
||||
'Archlinux': {
|
||||
$package_ensure = 'installed'
|
||||
$package_name = 'rabbitmq'
|
||||
$service_name = 'rabbitmq'
|
||||
$package_source = ''
|
||||
$version = '3.1.3-1'
|
||||
$base_version = regsubst($version,'^(.*)-\d$','\1')
|
||||
# This must remain at the end as we need $base_version and $version defined first
|
||||
}
|
||||
'Debian': {
|
||||
$package_ensure = 'installed'
|
||||
$package_name = 'rabbitmq-server'
|
||||
$service_name = 'rabbitmq-server'
|
||||
$package_provider = 'apt'
|
||||
$package_source = ''
|
||||
$version = '3.1.5'
|
||||
}
|
||||
'RedHat': {
|
||||
$package_ensure = 'installed'
|
||||
$package_name = 'rabbitmq-server'
|
||||
$service_name = 'rabbitmq-server'
|
||||
$package_provider = 'yum'
|
||||
$version = '3.1.5-1'
|
||||
$base_version = regsubst($version,'^(.*)-\d$','\1')
|
||||
# This must remain at the end as we need $base_version and $version defined first.
|
||||
$package_source = "http://www.rabbitmq.com/releases/rabbitmq-server/v${base_version}/rabbitmq-server-${version}.noarch.rpm"
|
||||
}
|
||||
'SUSE': {
|
||||
$package_ensure = 'installed'
|
||||
$package_name = 'rabbitmq-server'
|
||||
$service_name = 'rabbitmq-server'
|
||||
$package_provider = 'zypper'
|
||||
$version = '3.1.5-1'
|
||||
$base_version = regsubst($version,'^(.*)-\d$','\1')
|
||||
# This must remain at the end as we need $base_version and $version defined first.
|
||||
$package_source = "http://www.rabbitmq.com/releases/rabbitmq-server/v${base_version}/rabbitmq-server-${version}.noarch.rpm"
|
||||
}
|
||||
default: {
|
||||
fail("The ${module_name} module is not supported on an ${::osfamily} based system.")
|
||||
}
|
||||
}
|
||||
|
||||
#install
|
||||
$admin_enable = true
|
||||
$management_port = '15672'
|
||||
$package_apt_pin = ''
|
||||
$package_gpg_key = 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
|
||||
$manage_repos = true
|
||||
$service_ensure = 'running'
|
||||
$service_manage = true
|
||||
#config
|
||||
$cluster_disk_nodes = []
|
||||
$cluster_node_type = 'disc'
|
||||
$cluster_nodes = []
|
||||
$config = 'rabbitmq/rabbitmq.config.erb'
|
||||
$config_cluster = false
|
||||
$config_mirrored_queues = false
|
||||
$config_path = '/etc/rabbitmq/rabbitmq.config'
|
||||
$config_stomp = false
|
||||
$default_user = 'guest'
|
||||
$default_pass = 'guest'
|
||||
$delete_guest_user = false
|
||||
$env_config = 'rabbitmq/rabbitmq-env.conf.erb'
|
||||
$env_config_path = '/etc/rabbitmq/rabbitmq-env.conf'
|
||||
$erlang_cookie = 'EOKOWXQREETZSHFNTPEY'
|
||||
$node_ip_address = 'UNSET'
|
||||
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
|
||||
$port = '5672'
|
||||
$ssl = false
|
||||
$ssl_only = false
|
||||
$ssl_cacert = 'UNSET'
|
||||
$ssl_cert = 'UNSET'
|
||||
$ssl_key = 'UNSET'
|
||||
$ssl_management_port = '5671'
|
||||
$ssl_stomp_port = '6164'
|
||||
$ssl_verify = 'verify_none'
|
||||
$ssl_fail_if_no_peer_cert = 'false'
|
||||
$stomp_ensure = false
|
||||
$ldap_auth = false
|
||||
$ldap_server = 'ldap'
|
||||
$ldap_user_dn_pattern = 'cn=${username},ou=People,dc=example,dc=com'
|
||||
$ldap_use_ssl = false
|
||||
$ldap_port = '389'
|
||||
$ldap_log = false
|
||||
$stomp_port = '6163'
|
||||
$wipe_db_on_cookie_change = false
|
||||
$cluster_partition_handling = 'ignore'
|
||||
$environment_variables = {}
|
||||
$config_variables = {}
|
||||
$config_kernel_variables = {}
|
||||
}
|
15
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/policy.pp
vendored
Normal file
15
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/policy.pp
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
define rabbitmq::policy (
|
||||
$pattern,
|
||||
$definition,
|
||||
$vhost = '/',
|
||||
$priority = 0,
|
||||
) {
|
||||
|
||||
exec { "rabbitmq policy: ${title}":
|
||||
command => "rabbitmqctl set_policy -p ${vhost} '${name}' '${pattern}' '${definition}' ${priority}",
|
||||
unless => "rabbitmqctl list_policies | grep -qE '^${vhost}\\s+${name}\\s+${pattern}\\s+${definition}\\s+${priority}$'",
|
||||
path => ['/bin','/sbin','/usr/bin','/usr/sbin'],
|
||||
require => Class['rabbitmq::service'],
|
||||
before => Anchor['rabbitmq::end']
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
# requires
|
||||
# puppetlabs-apt
|
||||
# puppetlabs-stdlib
|
||||
class rabbitmq::repo::apt(
|
||||
$location = 'http://www.rabbitmq.com/debian/',
|
||||
$release = 'testing',
|
||||
$repos = 'main',
|
||||
$include_src = false,
|
||||
$key = '056E8E56',
|
||||
$key_source = 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc',
|
||||
) {
|
||||
|
||||
$pin = $rabbitmq::package_apt_pin
|
||||
|
||||
Class['rabbitmq::repo::apt'] -> Package<| title == 'rabbitmq-server' |>
|
||||
|
||||
apt::source { 'rabbitmq':
|
||||
location => $location,
|
||||
release => $release,
|
||||
repos => $repos,
|
||||
include_src => $include_src,
|
||||
key => $key,
|
||||
key_source => $key_source,
|
||||
}
|
||||
|
||||
if $pin {
|
||||
validate_re($pin, '\d\d\d')
|
||||
apt::pin { 'rabbitmq':
|
||||
packages => 'rabbitmq-server',
|
||||
priority => $pin,
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
class rabbitmq::repo::rhel {
|
||||
|
||||
$package_gpg_key = $rabbitmq::package_gpg_key
|
||||
|
||||
Class['rabbitmq::repo::rhel'] -> Package<| title == 'rabbitmq-server' |>
|
||||
|
||||
exec { "rpm --import ${package_gpg_key}":
|
||||
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
|
||||
onlyif => 'test `rpm -qa | grep gpg-pubkey-056e8e56-468e43f2 | wc -l` -eq 0',
|
||||
}
|
||||
|
||||
}
|
100
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/server.pp
vendored
Normal file
100
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/manifests/server.pp
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
# Class: rabbitmq::server
|
||||
#
|
||||
# This module manages the installation and config of the rabbitmq server
|
||||
# it has only been tested on certain version of debian-ish systems
|
||||
# Parameters:
|
||||
# [*port*] - port where rabbitmq server is hosted
|
||||
# [*delete_guest_user*] - rather or not to delete the default user
|
||||
# [*version*] - version of rabbitmq-server to install
|
||||
# [*package_name*] - name of rabbitmq package
|
||||
# [*service_name*] - name of rabbitmq service
|
||||
# [*service_ensure*] - desired ensure state for service
|
||||
# [*stomp_port*] - port stomp should be listening on
|
||||
# [*node_ip_address*] - ip address for rabbitmq to bind to
|
||||
# [*config*] - contents of config file
|
||||
# [*env_config*] - contents of env-config file
|
||||
# [*config_cluster*] - whether to configure a RabbitMQ cluster
|
||||
# [*config_mirrored_queues*] - DEPRECATED (doesn't do anything)
|
||||
# [*cluster_disk_nodes*] - DEPRECATED (use cluster_nodes instead)
|
||||
# [*cluster_nodes*] - which nodes to cluster with (including the current one)
|
||||
# [*cluster_node_type*] - Type of cluster node (disc or ram)
|
||||
# [*erlang_cookie*] - erlang cookie, must be the same for all nodes in a cluster
|
||||
# [*wipe_db_on_cookie_change*] - whether to wipe the RabbitMQ data if the specified
|
||||
# erlang_cookie differs from the current one. This is a sad parameter: actually,
|
||||
# if the cookie indeed differs, then wiping the database is the *only* thing you
|
||||
# can do. You're only required to set this parameter to true as a sign that you
|
||||
# realise this.
|
||||
# Requires:
|
||||
# stdlib
|
||||
# Sample Usage:
|
||||
#
|
||||
# This module is used as backward compability layer for modules
|
||||
# which require rabbitmq::server instead of rabbitmq class.
|
||||
# It's still common uasge in many modules.
|
||||
#
|
||||
#
|
||||
# [Remember: No empty lines between comments and class definition]
|
||||
class rabbitmq::server(
|
||||
$port = $rabbitmq::params::port,
|
||||
$delete_guest_user = $rabbitmq::params::delete_guest_user,
|
||||
$package_name = $rabbitmq::params::package_name,
|
||||
$version = $rabbitmq::params::version,
|
||||
$service_name = $rabbitmq::params::service_name,
|
||||
$service_ensure = $rabbitmq::params::service_ensure,
|
||||
$service_manage = $rabbitmq::params::service_manage,
|
||||
$config_stomp = $rabbitmq::params::config_stomp,
|
||||
$stomp_port = $rabbitmq::params::stomp_port,
|
||||
$config_cluster = $rabbitmq::params::config_cluster,
|
||||
$cluster_disk_nodes = $rabbitmq::params::cluster_disk_nodes,
|
||||
$cluster_nodes = $rabbitmq::params::cluster_nodes,
|
||||
$cluster_node_type = $rabbitmq::params::cluster_node_type,
|
||||
$node_ip_address = $rabbitmq::params::node_ip_address,
|
||||
$config = $rabbitmq::params::config,
|
||||
$env_config = $rabbitmq::params::env_config,
|
||||
$erlang_cookie = $rabbitmq::params::erlang_cookie,
|
||||
$wipe_db_on_cookie_change = $rabbitmq::params::wipe_db_on_cookie_change,
|
||||
# DEPRECATED
|
||||
$manage_service = undef,
|
||||
$config_mirrored_queues = undef,
|
||||
) inherits rabbitmq::params {
|
||||
|
||||
if $manage_service != undef {
|
||||
warning('The $manage_service parameter is deprecated; please use $service_manage instead')
|
||||
$_service_manage = $manage_service
|
||||
} else {
|
||||
$_service_manage = $service_manage
|
||||
}
|
||||
|
||||
if $config_mirrored_queues != undef {
|
||||
warning('The $config_mirrored_queues parameter is deprecated in this class, use the rabbitmq class')
|
||||
}
|
||||
|
||||
anchor {'before::rabbimq::class':
|
||||
before => Class['rabbitmq'],
|
||||
}
|
||||
|
||||
anchor {'after::rabbimq::class':
|
||||
require => Class['rabbitmq'],
|
||||
}
|
||||
|
||||
class { 'rabbitmq':
|
||||
port => $port,
|
||||
delete_guest_user => $delete_guest_user,
|
||||
package_name => $package_name,
|
||||
version => $version,
|
||||
service_name => $service_name,
|
||||
service_ensure => $service_ensure,
|
||||
service_manage => $_service_manage,
|
||||
config_stomp => $config_stomp,
|
||||
stomp_port => $stomp_port,
|
||||
config_cluster => $config_cluster,
|
||||
cluster_disk_nodes => $cluster_disk_nodes,
|
||||
cluster_nodes => $cluster_nodes,
|
||||
cluster_node_type => $cluster_node_type,
|
||||
node_ip_address => $node_ip_address,
|
||||
config => $config,
|
||||
env_config => $env_config,
|
||||
erlang_cookie => $erlang_cookie,
|
||||
wipe_db_on_cookie_change => $wipe_db_on_cookie_change,
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
# Class: rabbitmq::service
|
||||
#
|
||||
# This class manages the rabbitmq server service itself.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
class rabbitmq::service(
|
||||
$service_ensure = $rabbitmq::service_ensure,
|
||||
$service_manage = $rabbitmq::service_manage,
|
||||
$service_name = $rabbitmq::service_name,
|
||||
) inherits rabbitmq {
|
||||
|
||||
validate_re($service_ensure, '^(running|stopped)$')
|
||||
validate_bool($service_manage)
|
||||
|
||||
if ($service_manage) {
|
||||
if $service_ensure == 'running' {
|
||||
$ensure_real = 'running'
|
||||
$enable_real = true
|
||||
} else {
|
||||
$ensure_real = 'stopped'
|
||||
$enable_real = false
|
||||
}
|
||||
|
||||
service { 'rabbitmq-server':
|
||||
ensure => $ensure_real,
|
||||
enable => $enable_real,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
name => $service_name,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
Specs
|
||||
=====
|
||||
|
||||
The Puppet project uses RSpec for testing.
|
||||
|
||||
For more information on RSpec, see http://rspec.info/
|
||||
|
@@ -0,0 +1,96 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'rabbitmq class:' do
|
||||
case fact('osfamily')
|
||||
when 'RedHat'
|
||||
package_name = 'rabbitmq-server'
|
||||
service_name = 'rabbitmq-server'
|
||||
when 'SUSE'
|
||||
package_name = 'rabbitmq-server'
|
||||
service_name = 'rabbitmq-server'
|
||||
when 'Debian'
|
||||
package_name = 'rabbitmq-server'
|
||||
service_name = 'rabbitmq-server'
|
||||
when 'Archlinux'
|
||||
package_name = 'rabbitmq'
|
||||
service_name = 'rabbitmq'
|
||||
end
|
||||
|
||||
context "default class inclusion" do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq': }
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
# Apply twice to ensure no errors the second time.
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
expect(apply_manifest(pp, :catch_changes => true).exit_code).to be_zero
|
||||
end
|
||||
|
||||
describe package(package_name) do
|
||||
it { should be_installed }
|
||||
end
|
||||
|
||||
describe service(service_name) do
|
||||
it { should be_enabled }
|
||||
it { should be_running }
|
||||
end
|
||||
end
|
||||
|
||||
context "disable and stop service" do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq':
|
||||
service_ensure => 'stopped',
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
end
|
||||
|
||||
describe service(service_name) do
|
||||
it { should_not be_enabled }
|
||||
it { should_not be_running }
|
||||
end
|
||||
end
|
||||
|
||||
context "service is unmanaged" do
|
||||
it 'should run successfully' do
|
||||
pp_pre = <<-EOS
|
||||
class { 'rabbitmq': }
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq':
|
||||
service_manage => false,
|
||||
service_ensure => 'stopped',
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
|
||||
apply_manifest(pp_pre, :catch_failures => true)
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
end
|
||||
|
||||
describe service(service_name) do
|
||||
it { should be_enabled }
|
||||
it { should be_running }
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,34 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'rabbitmq clustering' do
|
||||
context 'rabbitmq::config_cluster => true' do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq':
|
||||
config_cluster => true,
|
||||
cluster_nodes => ['rabbit1', 'rabbit2'],
|
||||
cluster_node_type => 'ram',
|
||||
wipe_db_on_cookie_change => true,
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
end
|
||||
|
||||
describe file('/etc/rabbitmq/rabbitmq.config') do
|
||||
it { should be_file }
|
||||
it { should contain 'cluster_nodes' }
|
||||
it { should contain 'rabbit@rabbit1' }
|
||||
it { should contain 'rabbit@rabbit2' }
|
||||
it { should contain 'ram' }
|
||||
end
|
||||
|
||||
describe file('/var/lib/rabbitmq/.erlang.cookie') do
|
||||
it { should be_file }
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,26 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'rabbitmq with delete_guest_user' do
|
||||
context 'delete_guest_user' do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq':
|
||||
port => '5672',
|
||||
delete_guest_user => true,
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
shell('rabbitmqctl list_users > /tmp/rabbitmqctl_users')
|
||||
end
|
||||
|
||||
describe file('/tmp/rabbitmqctl_users') do
|
||||
it { should be_file }
|
||||
it { should_not contain 'guest' }
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
centos-64-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: el-6-x86_64
|
||||
box : centos-64-x64-vbox4210-nocm
|
||||
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
|
||||
hypervisor : vagrant
|
||||
CONFIG:
|
||||
log_level: debug
|
||||
type: git
|
@@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
ubuntu-server-1310-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-13.10-amd64
|
||||
box : ubuntu-server-1310-x64-vbox4210-nocm
|
||||
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-1310-x64-virtualbox-nocm.box
|
||||
hypervisor : vagrant
|
||||
CONFIG:
|
||||
log_level : debug
|
||||
type: git
|
@@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
ubuntu-server-1404-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-14.04-amd64
|
||||
box : trusty-server-cloudimg-amd64-vagrant-disk1
|
||||
box_url : https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
|
||||
hypervisor : vagrant
|
||||
CONFIG:
|
||||
log_level : debug
|
||||
type: git
|
@@ -0,0 +1,46 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'rabbitmq::install::rabbitmqadmin class' do
|
||||
context 'does nothing if service is unmanaged' do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq':
|
||||
admin_enable => true,
|
||||
service_manage => false,
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
shell('rm -f /var/lib/rabbitmq/rabbitmqadmin')
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
end
|
||||
|
||||
describe file('/var/lib/rabbitmq/rabbitmqadmin') do
|
||||
it { should_not be_file }
|
||||
end
|
||||
end
|
||||
|
||||
context 'downloads the cli tools' do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq':
|
||||
admin_enable => true,
|
||||
service_manage => true,
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
end
|
||||
|
||||
describe file('/var/lib/rabbitmq/rabbitmqadmin') do
|
||||
it { should be_file }
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,96 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'rabbitmq server:' do
|
||||
case fact('osfamily')
|
||||
when 'RedHat'
|
||||
package_name = 'rabbitmq-server'
|
||||
service_name = 'rabbitmq-server'
|
||||
when 'SUSE'
|
||||
package_name = 'rabbitmq-server'
|
||||
service_name = 'rabbitmq-server'
|
||||
when 'Debian'
|
||||
package_name = 'rabbitmq-server'
|
||||
service_name = 'rabbitmq-server'
|
||||
when 'Archlinux'
|
||||
package_name = 'rabbitmq'
|
||||
service_name = 'rabbitmq'
|
||||
end
|
||||
|
||||
context "default class inclusion" do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq::server': }
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq::server']
|
||||
}
|
||||
EOS
|
||||
|
||||
# Apply twice to ensure no errors the second time.
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
expect(apply_manifest(pp, :catch_changes => true).exit_code).to be_zero
|
||||
end
|
||||
|
||||
describe package(package_name) do
|
||||
it { should be_installed }
|
||||
end
|
||||
|
||||
describe service(service_name) do
|
||||
it { should be_enabled }
|
||||
it { should be_running }
|
||||
end
|
||||
end
|
||||
|
||||
context "disable and stop service" do
|
||||
it 'should run successfully' do
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq::server':
|
||||
service_ensure => 'stopped',
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq::server']
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
end
|
||||
|
||||
describe service(service_name) do
|
||||
it { should_not be_enabled }
|
||||
it { should_not be_running }
|
||||
end
|
||||
end
|
||||
|
||||
context "service is unmanaged" do
|
||||
it 'should run successfully' do
|
||||
pp_pre = <<-EOS
|
||||
class { 'rabbitmq::server': }
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq::server']
|
||||
}
|
||||
EOS
|
||||
|
||||
pp = <<-EOS
|
||||
class { 'rabbitmq::server':
|
||||
service_manage => false,
|
||||
service_ensure => 'stopped',
|
||||
}
|
||||
if $::osfamily == 'RedHat' {
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq::server']
|
||||
}
|
||||
EOS
|
||||
|
||||
|
||||
apply_manifest(pp_pre, :catch_failures => true)
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
end
|
||||
|
||||
describe service(service_name) do
|
||||
it { should be_enabled }
|
||||
it { should be_running }
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,531 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'rabbitmq' do
|
||||
|
||||
context 'on unsupported distributions' do
|
||||
let(:facts) {{ :osfamily => 'Unsupported' }}
|
||||
|
||||
it 'we fail' do
|
||||
expect { subject }.to raise_error(/not supported on an Unsupported/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian' do
|
||||
let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
|
||||
it 'includes rabbitmq::repo::apt' do
|
||||
should contain_class('rabbitmq::repo::apt')
|
||||
end
|
||||
|
||||
describe 'apt::source default values' do
|
||||
let(:facts) {{ :osfamily => 'Debian' }}
|
||||
it 'should add a repo with defaults values' do
|
||||
contain_file('/etc/apt/sources.list.d/rabbitmq.list')\
|
||||
.with_content(%r|deb http\://www\.rabbitmq.com/debian/ testing main|)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'apt::source custom values' do
|
||||
let(:params) {
|
||||
{ :location => 'http://www.foorepo.com/debian',
|
||||
:release => 'unstable',
|
||||
:repos => 'main'
|
||||
}}
|
||||
it 'should add a repo with custom new values' do
|
||||
contain_file('/etc/apt/sources.list.d/rabbitmq.list')\
|
||||
.with_content(%r|deb http\://www\.foorepo.com/debian/ unstable main|)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian' do
|
||||
let(:params) {{ :manage_repos => false }}
|
||||
let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'squeeze' }}
|
||||
it 'does not include rabbitmq::repo::apt when manage_repos is false' do
|
||||
should_not contain_class('rabbitmq::repo::apt')
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Redhat' do
|
||||
let(:facts) {{ :osfamily => 'RedHat' }}
|
||||
it 'includes rabbitmq::repo::rhel' do
|
||||
should contain_class('rabbitmq::repo::rhel')
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Redhat' do
|
||||
let(:params) {{ :manage_repos => false }}
|
||||
let(:facts) {{ :osfamily => 'RedHat' }}
|
||||
it 'does not include rabbitmq::repo::rhel when manage_repos is false' do
|
||||
should_not contain_class('rabbitmq::repo::rhel')
|
||||
end
|
||||
end
|
||||
|
||||
['Debian', 'RedHat', 'SUSE', 'Archlinux'].each do |distro|
|
||||
context "on #{distro}" do
|
||||
let(:facts) {{
|
||||
:osfamily => distro,
|
||||
:rabbitmq_erlang_cookie => 'EOKOWXQREETZSHFNTPEY',
|
||||
:lsbdistcodename => 'squeeze',
|
||||
:lsbdistid => 'Debian'
|
||||
}}
|
||||
|
||||
it { should contain_class('rabbitmq::install') }
|
||||
it { should contain_class('rabbitmq::config') }
|
||||
it { should contain_class('rabbitmq::service') }
|
||||
|
||||
|
||||
context 'with admin_enable set to true' do
|
||||
let(:params) {{ :admin_enable => true }}
|
||||
context 'with service_manage set to true' do
|
||||
it 'we enable the admin interface by default' do
|
||||
should contain_class('rabbitmq::install::rabbitmqadmin')
|
||||
should contain_rabbitmq_plugin('rabbitmq_management').with(
|
||||
'require' => 'Class[Rabbitmq::Install]',
|
||||
'notify' => 'Class[Rabbitmq::Service]'
|
||||
)
|
||||
end
|
||||
end
|
||||
context 'with service_manage set to false' do
|
||||
let(:params) {{ :admin_enable => true, :service_manage => false }}
|
||||
it 'should do nothing' do
|
||||
should_not contain_class('rabbitmq::install::rabbitmqadmin')
|
||||
should_not contain_rabbitmq_plugin('rabbitmq_management')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'deprecated parameters' do
|
||||
describe 'cluster_disk_nodes' do
|
||||
let(:params) {{ :cluster_disk_nodes => ['node1', 'node2'] }}
|
||||
|
||||
it { should contain_notify('cluster_disk_nodes') }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'manages configuration directory correctly' do
|
||||
it { should contain_file('/etc/rabbitmq').with(
|
||||
'ensure' => 'directory'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'manages configuration file correctly' do
|
||||
it { should contain_file('rabbitmq.config') }
|
||||
end
|
||||
|
||||
context 'configures config_cluster' do
|
||||
let(:facts) {{ :osfamily => distro, :rabbitmq_erlang_cookie => 'ORIGINAL', :lsbdistid => 'Debian' }}
|
||||
let(:params) {{
|
||||
:config_cluster => true,
|
||||
:cluster_nodes => ['hare-1', 'hare-2'],
|
||||
:cluster_node_type => 'ram',
|
||||
:erlang_cookie => 'TESTCOOKIE',
|
||||
:wipe_db_on_cookie_change => false
|
||||
}}
|
||||
|
||||
describe 'with defaults' do
|
||||
it 'fails' do
|
||||
expect{subject}.to raise_error(/^ERROR: The current erlang cookie is ORIGINAL/)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with wipe_db_on_cookie_change set' do
|
||||
let(:params) {{
|
||||
:config_cluster => true,
|
||||
:cluster_nodes => ['hare-1', 'hare-2'],
|
||||
:cluster_node_type => 'ram',
|
||||
:erlang_cookie => 'TESTCOOKIE',
|
||||
:wipe_db_on_cookie_change => true
|
||||
}}
|
||||
it 'wipes the database' do
|
||||
should contain_exec('wipe_db')
|
||||
should contain_file('erlang_cookie')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'correctly when cookies match' do
|
||||
let(:params) {{
|
||||
:config_cluster => true,
|
||||
:cluster_nodes => ['hare-1', 'hare-2'],
|
||||
:cluster_node_type => 'ram',
|
||||
:erlang_cookie => 'ORIGINAL',
|
||||
:wipe_db_on_cookie_change => true
|
||||
}}
|
||||
it 'and doesnt wipe anything' do
|
||||
should contain_file('erlang_cookie')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'and sets appropriate configuration' do
|
||||
let(:params) {{
|
||||
:config_cluster => true,
|
||||
:cluster_nodes => ['hare-1', 'hare-2'],
|
||||
:cluster_node_type => 'ram',
|
||||
:erlang_cookie => 'ORIGINAL',
|
||||
:wipe_db_on_cookie_change => true
|
||||
}}
|
||||
it 'for cluster_nodes' do
|
||||
should contain_file('rabbitmq.config').with({
|
||||
'content' => /cluster_nodes.*\['rabbit@hare-1', 'rabbit@hare-2'\], ram/,
|
||||
})
|
||||
end
|
||||
|
||||
it 'for erlang_cookie' do
|
||||
should contain_file('erlang_cookie').with({
|
||||
'content' => 'ORIGINAL',
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'rabbitmq-env configuration' do
|
||||
let(:params) {{ :environment_variables => {
|
||||
'RABBITMQ_NODE_IP_ADDRESS' => '1.1.1.1',
|
||||
'RABBITMQ_NODE_PORT' => '5656',
|
||||
'RABBITMQ_NODENAME' => 'HOSTNAME',
|
||||
'RABBITMQ_SERVICENAME' => 'RabbitMQ',
|
||||
'RABBITMQ_CONSOLE_LOG' => 'RabbitMQ.debug',
|
||||
'RABBITMQ_CTL_ERL_ARGS' => 'verbose',
|
||||
'RABBITMQ_SERVER_ERL_ARGS' => 'v',
|
||||
'RABBITMQ_SERVER_START_ARGS' => 'debug'
|
||||
}}}
|
||||
it 'should set environment variables' do
|
||||
should contain_file('rabbitmq-env.config') \
|
||||
.with_content(/RABBITMQ_NODE_IP_ADDRESS=1.1.1.1/) \
|
||||
.with_content(/RABBITMQ_NODE_PORT=5656/) \
|
||||
.with_content(/RABBITMQ_NODENAME=HOSTNAME/) \
|
||||
.with_content(/RABBITMQ_SERVICENAME=RabbitMQ/) \
|
||||
.with_content(/RABBITMQ_CONSOLE_LOG=RabbitMQ.debug/) \
|
||||
.with_content(/RABBITMQ_CTL_ERL_ARGS=verbose/) \
|
||||
.with_content(/RABBITMQ_SERVER_ERL_ARGS=v/) \
|
||||
.with_content(/RABBITMQ_SERVER_START_ARGS=debug/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'delete_guest_user' do
|
||||
describe 'should do nothing by default' do
|
||||
it { should_not contain_rabbitmq_user('guest') }
|
||||
end
|
||||
|
||||
describe 'delete user when delete_guest_user set' do
|
||||
let(:params) {{ :delete_guest_user => true }}
|
||||
it 'removes the user' do
|
||||
should contain_rabbitmq_user('guest').with(
|
||||
'ensure' => 'absent',
|
||||
'provider' => 'rabbitmqctl'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'configuration setting' do
|
||||
describe 'node_ip_address when set' do
|
||||
let(:params) {{ :node_ip_address => '172.0.0.1' }}
|
||||
it 'should set RABBITMQ_NODE_IP_ADDRESS to specified value' do
|
||||
contain_file('rabbitmq-env.config').with({
|
||||
'content' => 'RABBITMQ_NODE_IP_ADDRESS=172.0.0.1',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'stomp by default' do
|
||||
it 'should not specify stomp parameters in rabbitmq.config' do
|
||||
contain_file('rabbitmq.config').without({
|
||||
'content' => /stomp/,})
|
||||
end
|
||||
end
|
||||
describe 'stomp when set' do
|
||||
let(:params) {{ :config_stomp => true, :stomp_port => 5679 }}
|
||||
it 'should specify stomp port in rabbitmq.config' do
|
||||
contain_file('rabbitmq.config').with({
|
||||
'content' => /rabbitmq_stomp.*tcp_listeners, \[5679\]/,
|
||||
})
|
||||
end
|
||||
end
|
||||
describe 'stomp when set with ssl' do
|
||||
let(:params) {{ :config_stomp => true, :stomp_port => 5679, :ssl_stomp_port => 5680 }}
|
||||
it 'should specify stomp port and ssl stomp port in rabbitmq.config' do
|
||||
contain_file('rabbitmq.config').with({
|
||||
'content' => /rabbitmq_stomp.*tcp_listeners, \[5679\].*ssl_listeners, \[5680\]/,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'configuring ldap authentication' do
|
||||
let :params do
|
||||
{ :config_stomp => true,
|
||||
:ldap_auth => true,
|
||||
:ldap_server => 'ldap.example.com',
|
||||
:ldap_user_dn_pattern => 'ou=users,dc=example,dc=com',
|
||||
:ldap_use_ssl => false,
|
||||
:ldap_port => '389',
|
||||
:ldap_log => true
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
|
||||
|
||||
it 'should contain ldap parameters' do
|
||||
verify_contents(subject, 'rabbitmq.config',
|
||||
['[', ' {rabbit, [', ' {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},', ' ]}',
|
||||
' {rabbitmq_auth_backend_ldap, [', ' {other_bind, anon},',
|
||||
' {servers, ["ldap.example.com"]},',
|
||||
' {user_dn_pattern, "ou=users,dc=example,dc=com"},', ' {use_ssl, false},',
|
||||
' {port, 389},', ' {log, true}'])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'configuring ldap authentication' do
|
||||
let :params do
|
||||
{ :config_stomp => false,
|
||||
:ldap_auth => true,
|
||||
:ldap_server => 'ldap.example.com',
|
||||
:ldap_user_dn_pattern => 'ou=users,dc=example,dc=com',
|
||||
:ldap_use_ssl => false,
|
||||
:ldap_port => '389',
|
||||
:ldap_log => true
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
|
||||
|
||||
it 'should contain ldap parameters' do
|
||||
verify_contents(subject, 'rabbitmq.config',
|
||||
['[', ' {rabbit, [', ' {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},', ' ]}',
|
||||
' {rabbitmq_auth_backend_ldap, [', ' {other_bind, anon},',
|
||||
' {servers, ["ldap.example.com"]},',
|
||||
' {user_dn_pattern, "ou=users,dc=example,dc=com"},', ' {use_ssl, false},',
|
||||
' {port, 389},', ' {log, true}'])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'default_user and default_pass set' do
|
||||
let(:params) {{ :default_user => 'foo', :default_pass => 'bar' }}
|
||||
it 'should set default_user and default_pass to specified values' do
|
||||
contain_file('rabbitmq.config').with({
|
||||
'content' => /default_user, <<"foo">>.*default_pass, <<"bar">>/,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ssl options' do
|
||||
let(:params) {
|
||||
{ :ssl => true,
|
||||
:ssl_management_port => 3141,
|
||||
:ssl_cacert => '/path/to/cacert',
|
||||
:ssl_cert => '/path/to/cert',
|
||||
:ssl_key => '/path/to/key'
|
||||
} }
|
||||
|
||||
it 'should set ssl options to specified values' do
|
||||
contain_file('rabbitmq.config').with({
|
||||
'content' => %r|ssl_listeners, \[3141\].*
|
||||
ssl_options, \[{cacertfile,"/path/to/cacert".*
|
||||
certfile="/path/to/cert".*
|
||||
keyfile,"/path/to/key|,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ssl options with ssl_only' do
|
||||
let(:params) {
|
||||
{ :ssl => true,
|
||||
:ssl_only => true,
|
||||
:ssl_management_port => 3141,
|
||||
:ssl_cacert => '/path/to/cacert',
|
||||
:ssl_cert => '/path/to/cert',
|
||||
:ssl_key => '/path/to/key'
|
||||
} }
|
||||
|
||||
it 'should set ssl options to specified values' do
|
||||
contain_file('rabbitmq.config').with({
|
||||
'content' => %r|tcp_listeners, \[\].*
|
||||
ssl_listeners, \[3141\].*
|
||||
ssl_options, \[{cacertfile,"/path/to/cacert".*
|
||||
certfile="/path/to/cert".*
|
||||
keyfile,"/path/to/key|,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'config_variables options' do
|
||||
let(:params) {{ :config_variables => {
|
||||
'hipe_compile' => true,
|
||||
'vm_memory_high_watermark' => 0.4,
|
||||
'frame_max' => 131072,
|
||||
'collect_statistics' => "none",
|
||||
'auth_mechanisms' => "['PLAIN', 'AMQPLAIN']",
|
||||
}}}
|
||||
it 'should set environment variables' do
|
||||
should contain_file('rabbitmq.config') \
|
||||
.with_content(/\{hipe_compile, true\}/) \
|
||||
.with_content(/\{vm_memory_high_watermark, 0.4\}/) \
|
||||
.with_content(/\{frame_max, 131072\}/) \
|
||||
.with_content(/\{collect_statistics, none\}/) \
|
||||
.with_content(/\{auth_mechanisms, \['PLAIN', 'AMQPLAIN'\]\}/)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'config_kernel_variables options' do
|
||||
let(:params) {{ :config_kernel_variables => {
|
||||
'inet_dist_listen_min' => 9100,
|
||||
'inet_dist_listen_max' => 9105,
|
||||
}}}
|
||||
it 'should set config variables' do
|
||||
should contain_file('rabbitmq.config') \
|
||||
.with_content(/\{inet_dist_listen_min, 9100\}/) \
|
||||
.with_content(/\{inet_dist_listen_max, 9105\}/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'delete_guest_user' do
|
||||
describe 'should do nothing by default' do
|
||||
it { should_not contain_rabbitmq_user('guest') }
|
||||
end
|
||||
|
||||
describe 'delete user when delete_guest_user set' do
|
||||
let(:params) {{ :delete_guest_user => true }}
|
||||
it 'removes the user' do
|
||||
should contain_rabbitmq_user('guest').with(
|
||||
'ensure' => 'absent',
|
||||
'provider' => 'rabbitmqctl'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
## rabbitmq::service
|
||||
##
|
||||
describe 'service with default params' do
|
||||
it { should contain_service('rabbitmq-server').with(
|
||||
'ensure' => 'running',
|
||||
'enable' => 'true',
|
||||
'hasstatus' => 'true',
|
||||
'hasrestart' => 'true'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'service with ensure stopped' do
|
||||
let :params do
|
||||
{ :service_ensure => 'stopped' }
|
||||
end
|
||||
|
||||
it { should contain_service('rabbitmq-server').with(
|
||||
'ensure' => 'stopped',
|
||||
'enable' => false
|
||||
) }
|
||||
end
|
||||
|
||||
describe 'service with ensure neither running neither stopped' do
|
||||
let :params do
|
||||
{ :service_ensure => 'foo' }
|
||||
end
|
||||
|
||||
it 'should raise an error' do
|
||||
expect {
|
||||
should contain_service('rabbitmq-server').with(
|
||||
'ensure' => 'stopped' )
|
||||
}.to raise_error(Puppet::Error, /validate_re\(\): "foo" does not match "\^\(running\|stopped\)\$"/)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'service with service_manage equal to false' do
|
||||
let :params do
|
||||
{ :service_manage => false }
|
||||
end
|
||||
|
||||
it { should_not contain_service('rabbitmq-server') }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
## rabbitmq::install
|
||||
##
|
||||
context "on RHEL" do
|
||||
let(:facts) {{ :osfamily => 'RedHat' }}
|
||||
let(:params) {{ :package_source => 'http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.3/rabbitmq-server-3.2.3-1.noarch.rpm' }}
|
||||
it 'installs the rabbitmq package' do
|
||||
should contain_package('rabbitmq-server').with(
|
||||
'ensure' => 'installed',
|
||||
'name' => 'rabbitmq-server',
|
||||
'provider' => 'yum',
|
||||
'source' => 'http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.3/rabbitmq-server-3.2.3-1.noarch.rpm'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context "on Debian" do
|
||||
let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistcodename => 'precise' }}
|
||||
it 'installs the rabbitmq package' do
|
||||
should contain_package('rabbitmq-server').with(
|
||||
'ensure' => 'installed',
|
||||
'name' => 'rabbitmq-server',
|
||||
'provider' => 'apt'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context "on Archlinux" do
|
||||
let(:facts) {{ :osfamily => 'Archlinux' }}
|
||||
it 'installs the rabbitmq package' do
|
||||
should contain_package('rabbitmq-server').with(
|
||||
'ensure' => 'installed',
|
||||
'name' => 'rabbitmq')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'repo management on Debian' do
|
||||
let(:facts) {{ :osfamily => 'Debian', :lsbdistid => 'Debian' }}
|
||||
|
||||
context 'with no pin' do
|
||||
let(:params) {{ :package_apt_pin => '' }}
|
||||
describe 'it sets up an apt::source' do
|
||||
|
||||
it { should contain_apt__source('rabbitmq').with(
|
||||
'location' => 'http://www.rabbitmq.com/debian/',
|
||||
'release' => 'testing',
|
||||
'repos' => 'main',
|
||||
'include_src' => false,
|
||||
'key' => '056E8E56'
|
||||
) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'with pin' do
|
||||
let(:params) {{ :package_apt_pin => '700' }}
|
||||
describe 'it sets up an apt::source and pin' do
|
||||
|
||||
it { should contain_apt__source('rabbitmq').with(
|
||||
'location' => 'http://www.rabbitmq.com/debian/',
|
||||
'release' => 'testing',
|
||||
'repos' => 'main',
|
||||
'include_src' => false,
|
||||
'key' => '056E8E56'
|
||||
) }
|
||||
|
||||
it { should contain_apt__pin('rabbitmq').with(
|
||||
'packages' => 'rabbitmq-server',
|
||||
'priority' => '700'
|
||||
) }
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
['RedHat', 'SuSE'].each do |distro|
|
||||
describe "repo management on #{distro}" do
|
||||
describe 'imports the key' do
|
||||
let(:facts) {{ :osfamily => distro }}
|
||||
let(:params) {{ :package_gpg_key => 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc' }}
|
||||
|
||||
it { should contain_exec("rpm --import #{params[:package_gpg_key]}").with(
|
||||
'path' => ['/bin','/usr/bin','/sbin','/usr/sbin']
|
||||
) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
6
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/spec/spec.opts
vendored
Normal file
6
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/spec/spec.opts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
--format
|
||||
s
|
||||
--colour
|
||||
--loadby
|
||||
mtime
|
||||
--backtrace
|
@@ -0,0 +1 @@
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
@@ -0,0 +1,38 @@
|
||||
require 'beaker-rspec'
|
||||
|
||||
UNSUPPORTED_PLATFORMS = []
|
||||
|
||||
unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
|
||||
if hosts.first.is_pe?
|
||||
install_pe
|
||||
else
|
||||
install_puppet
|
||||
end
|
||||
hosts.each do |host|
|
||||
on hosts, "mkdir -p #{host['distmoduledir']}"
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
# Project root
|
||||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||
|
||||
# Readable test descriptions
|
||||
c.formatter = :documentation
|
||||
c.before :suite do
|
||||
puppet_module_install(:source => proj_root, :module_name => 'rabbitmq')
|
||||
hosts.each do |host|
|
||||
|
||||
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
|
||||
shell('puppet module install puppetlabs-stdlib', { :acceptable_exit_codes => [0,1] })
|
||||
if fact('osfamily') == 'Debian'
|
||||
shell('puppet module install puppetlabs-apt', { :acceptable_exit_codes => [0,1] })
|
||||
end
|
||||
shell('puppet module install nanliu-staging', { :acceptable_exit_codes => [0,1] })
|
||||
if fact('osfamily') == 'RedHat'
|
||||
shell('puppet module install garethr-erlang', { :acceptable_exit_codes => [0,1] })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -0,0 +1,19 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'rabbitmq_erlang_cookie', :type => :fact do
|
||||
before(:each) { Facter.clear }
|
||||
|
||||
it 'works correctly' do
|
||||
Facter.fact(:osfamily).stubs(:value).returns('RedHat')
|
||||
File.stubs(:exists?).with('/var/lib/rabbitmq/.erlang.cookie').returns(true)
|
||||
File.stubs(:read).with('/var/lib/rabbitmq/.erlang.cookie').returns('THISISACOOKIE')
|
||||
Facter.fact(:rabbitmq_erlang_cookie).value.should == 'THISISACOOKIE'
|
||||
end
|
||||
|
||||
it 'fails if file doesnt exist' do
|
||||
Facter.fact(:osfamily).stubs(:value).returns('RedHat')
|
||||
File.stubs(:exists?).with('/var/lib/rabbitmq/.erlang.cookie').returns(false)
|
||||
Facter.fact(:rabbitmq_erlang_cookie).value.should == nil
|
||||
end
|
||||
|
||||
end
|
@@ -0,0 +1,65 @@
|
||||
require 'puppet'
|
||||
require 'mocha'
|
||||
RSpec.configure do |config|
|
||||
config.mock_with :mocha
|
||||
end
|
||||
provider_class = Puppet::Type.type(:rabbitmq_exchange).provider(:rabbitmqadmin)
|
||||
describe provider_class do
|
||||
before :each do
|
||||
@resource = Puppet::Type::Rabbitmq_exchange.new(
|
||||
{:name => 'amq.direct@/',
|
||||
:type => :topic}
|
||||
)
|
||||
@provider = provider_class.new(@resource)
|
||||
end
|
||||
|
||||
it 'should return instances' do
|
||||
provider_class.expects(:rabbitmqctl).with('list_vhosts').returns <<-EOT
|
||||
Listing vhosts ...
|
||||
/
|
||||
...done.
|
||||
EOT
|
||||
provider_class.expects(:rabbitmqctl).with('list_exchanges', '-p', '/', 'name', 'type').returns <<-EOT
|
||||
Listing exchanges ...
|
||||
direct
|
||||
amq.direct direct
|
||||
amq.fanout fanout
|
||||
amq.headers headers
|
||||
amq.match headers
|
||||
amq.rabbitmq.log topic
|
||||
amq.rabbitmq.trace topic
|
||||
amq.topic topic
|
||||
...done.
|
||||
EOT
|
||||
instances = provider_class.instances
|
||||
instances.size.should == 8
|
||||
end
|
||||
|
||||
it 'should call rabbitmqadmin to create' do
|
||||
@provider.expects(:rabbitmqadmin).with('declare', 'exchange', '--vhost=/', '--user=guest', '--password=guest', 'name=amq.direct', 'type=topic')
|
||||
@provider.create
|
||||
end
|
||||
|
||||
it 'should call rabbitmqadmin to destroy' do
|
||||
@provider.expects(:rabbitmqadmin).with('delete', 'exchange', '--vhost=/', '--user=guest', '--password=guest', 'name=amq.direct')
|
||||
@provider.destroy
|
||||
end
|
||||
|
||||
context 'specifying credentials' do
|
||||
before :each do
|
||||
@resource = Puppet::Type::Rabbitmq_exchange.new(
|
||||
{:name => 'amq.direct@/',
|
||||
:type => :topic,
|
||||
:user => 'colin',
|
||||
:password => 'secret',
|
||||
}
|
||||
)
|
||||
@provider = provider_class.new(@resource)
|
||||
end
|
||||
|
||||
it 'should call rabbitmqadmin to create' do
|
||||
@provider.expects(:rabbitmqadmin).with('declare', 'exchange', '--vhost=/', '--user=colin', '--password=secret', 'name=amq.direct', 'type=topic')
|
||||
@provider.create
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,236 @@
|
||||
require 'puppet'
|
||||
require 'mocha'
|
||||
RSpec.configure do |config|
|
||||
config.mock_with :mocha
|
||||
end
|
||||
provider_class = Puppet::Type.type(:rabbitmq_user).provider(:rabbitmqctl)
|
||||
describe provider_class do
|
||||
before :each do
|
||||
@resource = Puppet::Type::Rabbitmq_user.new(
|
||||
{:name => 'foo', :password => 'bar'}
|
||||
)
|
||||
@provider = provider_class.new(@resource)
|
||||
end
|
||||
it 'should match user names' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should == 'foo'
|
||||
end
|
||||
it 'should match user names with 2.4.1 syntax' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo bar
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should == 'foo bar'
|
||||
end
|
||||
it 'should not match if no users on system' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should be_nil
|
||||
end
|
||||
it 'should not match if no matching users on system' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
fooey
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should be_nil
|
||||
end
|
||||
it 'should match user names from list' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
one
|
||||
two three
|
||||
foo
|
||||
bar
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should == 'foo'
|
||||
end
|
||||
it 'should create user and set password' do
|
||||
@resource[:password] = 'bar'
|
||||
@provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
|
||||
@provider.create
|
||||
end
|
||||
it 'should create user, set password and set to admin' do
|
||||
@resource[:password] = 'bar'
|
||||
@resource[:admin] = 'true'
|
||||
@provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo []
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['administrator'])
|
||||
@provider.create
|
||||
end
|
||||
it 'should call rabbitmqctl to delete' do
|
||||
@provider.expects(:rabbitmqctl).with('delete_user', 'foo')
|
||||
@provider.destroy
|
||||
end
|
||||
it 'should be able to retrieve admin value' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo [administrator]
|
||||
...done.
|
||||
EOT
|
||||
@provider.admin.should == :true
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
one [administrator]
|
||||
foo []
|
||||
...done.
|
||||
EOT
|
||||
@provider.admin.should == :false
|
||||
end
|
||||
it 'should fail if admin value is invalid' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo fail
|
||||
...done.
|
||||
EOT
|
||||
expect { @provider.admin }.to raise_error(Puppet::Error, /Could not match line/)
|
||||
end
|
||||
it 'should be able to set admin value' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo []
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['administrator'])
|
||||
@provider.admin=:true
|
||||
end
|
||||
it 'should not interfere with existing tags on the user when setting admin value' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo [bar, baz]
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['bar','baz', 'administrator'].sort)
|
||||
@provider.admin=:true
|
||||
end
|
||||
it 'should be able to unset admin value' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo [administrator]
|
||||
guest [administrator]
|
||||
icinga []
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', [])
|
||||
@provider.admin=:false
|
||||
end
|
||||
it 'should not interfere with existing tags on the user when unsetting admin value' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo [administrator, bar, baz]
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['bar','baz'].sort)
|
||||
@provider.admin=:false
|
||||
end
|
||||
|
||||
it 'should clear all tags on existing user' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
one [administrator]
|
||||
foo [tag1,tag2]
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', [])
|
||||
@provider.tags=[]
|
||||
end
|
||||
|
||||
it 'should set multiple tags' do
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
one [administrator]
|
||||
foo []
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['tag1','tag2'])
|
||||
@provider.tags=['tag1','tag2']
|
||||
end
|
||||
|
||||
it 'should clear tags while keep admin tag' do
|
||||
@resource[:admin] = true
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
one [administrator]
|
||||
foo [administrator, tag1, tag2]
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"])
|
||||
@provider.tags=[]
|
||||
end
|
||||
|
||||
it 'should change tags while keep admin tag' do
|
||||
@resource[:admin] = true
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
one [administrator]
|
||||
foo [administrator, tag1, tag2]
|
||||
icinga [monitoring]
|
||||
kitchen []
|
||||
kitchen2 [abc, def, ghi]
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag3","tag7"])
|
||||
@provider.tags=['tag1','tag7','tag3']
|
||||
end
|
||||
|
||||
it 'should create user with tags and without admin' do
|
||||
@resource[:tags] = [ "tag1", "tag2" ]
|
||||
@provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["tag1","tag2"])
|
||||
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
|
||||
Listing users ...
|
||||
foo []
|
||||
...done.
|
||||
EOT
|
||||
@provider.create
|
||||
end
|
||||
|
||||
it 'should create user with tags and with admin' do
|
||||
@resource[:tags] = [ "tag1", "tag2" ]
|
||||
@resource[:admin] = true
|
||||
@provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
|
||||
@provider.expects(:rabbitmqctl).with('list_users').twice.returns <<-EOT
|
||||
Listing users ...
|
||||
foo []
|
||||
...done.
|
||||
EOT
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"])
|
||||
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag2"])
|
||||
@provider.create
|
||||
end
|
||||
|
||||
|
||||
end
|
@@ -0,0 +1,109 @@
|
||||
require 'puppet'
|
||||
require 'mocha'
|
||||
RSpec.configure do |config|
|
||||
config.mock_with :mocha
|
||||
end
|
||||
describe 'Puppet::Type.type(:rabbitmq_user_permissions).provider(:rabbitmqctl)' do
|
||||
before :each do
|
||||
@provider_class = Puppet::Type.type(:rabbitmq_user_permissions).provider(:rabbitmqctl)
|
||||
@resource = Puppet::Type::Rabbitmq_user_permissions.new(
|
||||
{:name => 'foo@bar'}
|
||||
)
|
||||
@provider = @provider_class.new(@resource)
|
||||
end
|
||||
after :each do
|
||||
@provider_class.instance_variable_set(:@users, nil)
|
||||
end
|
||||
it 'should match user permissions from list' do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
bar 1 2 3
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should == {:configure=>"1", :write=>"2", :read=>"3"}
|
||||
end
|
||||
it 'should match user permissions with empty columns' do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
bar 3
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should == {:configure=>"", :write=>"", :read=>"3"}
|
||||
end
|
||||
it 'should not match user permissions with more than 3 columns' do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
bar 1 2 3 4
|
||||
...done.
|
||||
EOT
|
||||
expect { @provider.exists? }.to raise_error(Puppet::Error, /cannot parse line from list_user_permissions/)
|
||||
end
|
||||
it 'should not match an empty list' do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should == nil
|
||||
end
|
||||
it 'should create default permissions' do
|
||||
@provider.instance_variable_set(:@should_vhost, "bar")
|
||||
@provider.instance_variable_set(:@should_user, "foo")
|
||||
@provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', "''", "''", "''")
|
||||
@provider.create
|
||||
end
|
||||
it 'should destroy permissions' do
|
||||
@provider.instance_variable_set(:@should_vhost, "bar")
|
||||
@provider.instance_variable_set(:@should_user, "foo")
|
||||
@provider.expects(:rabbitmqctl).with('clear_permissions', '-p', 'bar', 'foo')
|
||||
@provider.destroy
|
||||
end
|
||||
{:configure_permission => '1', :write_permission => '2', :read_permission => '3'}.each do |k,v|
|
||||
it "should be able to retrieve #{k}" do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
bar 1 2 3
|
||||
...done.
|
||||
EOT
|
||||
@provider.send(k).should == v
|
||||
end
|
||||
end
|
||||
{:configure_permission => '1', :write_permission => '2', :read_permission => '3'}.each do |k,v|
|
||||
it "should be able to retrieve #{k} after exists has been called" do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
bar 1 2 3
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?
|
||||
@provider.send(k).should == v
|
||||
end
|
||||
end
|
||||
{:configure_permission => ['foo', '2', '3'],
|
||||
:read_permission => ['1', '2', 'foo'],
|
||||
:write_permission => ['1', 'foo', '3']
|
||||
}.each do |perm, columns|
|
||||
it "should be able to sync #{perm}" do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
bar 1 2 3
|
||||
...done.
|
||||
EOT
|
||||
@provider.resource[perm] = 'foo'
|
||||
@provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', *columns)
|
||||
@provider.send("#{perm}=".to_sym, 'foo')
|
||||
end
|
||||
end
|
||||
it 'should only call set_permissions once' do
|
||||
@provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT
|
||||
Listing users ...
|
||||
bar 1 2 3
|
||||
...done.
|
||||
EOT
|
||||
@provider.resource[:configure_permission] = 'foo'
|
||||
@provider.resource[:read_permission] = 'foo'
|
||||
@provider.expects(:rabbitmqctl).with('set_permissions', '-p', 'bar', 'foo', 'foo', '2', 'foo').once
|
||||
@provider.configure_permission='foo'
|
||||
@provider.read_permission='foo'
|
||||
end
|
||||
end
|
||||
|
@@ -0,0 +1,45 @@
|
||||
require 'puppet'
|
||||
require 'mocha'
|
||||
RSpec.configure do |config|
|
||||
config.mock_with :mocha
|
||||
end
|
||||
provider_class = Puppet::Type.type(:rabbitmq_vhost).provider(:rabbitmqctl)
|
||||
describe provider_class do
|
||||
before :each do
|
||||
@resource = Puppet::Type::Rabbitmq_vhost.new(
|
||||
{:name => 'foo'}
|
||||
)
|
||||
@provider = provider_class.new(@resource)
|
||||
end
|
||||
it 'should match vhost names' do
|
||||
@provider.expects(:rabbitmqctl).with('list_vhosts').returns <<-EOT
|
||||
Listing vhosts ...
|
||||
foo
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should == 'foo'
|
||||
end
|
||||
it 'should not match if no vhosts on system' do
|
||||
@provider.expects(:rabbitmqctl).with('list_vhosts').returns <<-EOT
|
||||
Listing vhosts ...
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should be_nil
|
||||
end
|
||||
it 'should not match if no matching vhosts on system' do
|
||||
@provider.expects(:rabbitmqctl).with('list_vhosts').returns <<-EOT
|
||||
Listing vhosts ...
|
||||
fooey
|
||||
...done.
|
||||
EOT
|
||||
@provider.exists?.should be_nil
|
||||
end
|
||||
it 'should call rabbitmqctl to create' do
|
||||
@provider.expects(:rabbitmqctl).with('add_vhost', 'foo')
|
||||
@provider.create
|
||||
end
|
||||
it 'should call rabbitmqctl to create' do
|
||||
@provider.expects(:rabbitmqctl).with('delete_vhost', 'foo')
|
||||
@provider.destroy
|
||||
end
|
||||
end
|
@@ -0,0 +1,54 @@
|
||||
require 'puppet'
|
||||
require 'puppet/type/rabbitmq_exchange'
|
||||
describe Puppet::Type.type(:rabbitmq_exchange) do
|
||||
before :each do
|
||||
@exchange = Puppet::Type.type(:rabbitmq_exchange).new(
|
||||
:name => 'foo@bar',
|
||||
:type => :topic
|
||||
)
|
||||
end
|
||||
it 'should accept an exchange name' do
|
||||
@exchange[:name] = 'dan@pl'
|
||||
@exchange[:name].should == 'dan@pl'
|
||||
end
|
||||
it 'should require a name' do
|
||||
expect {
|
||||
Puppet::Type.type(:rabbitmq_exchange).new({})
|
||||
}.to raise_error(Puppet::Error, 'Title or name must be provided')
|
||||
end
|
||||
it 'should not allow whitespace in the name' do
|
||||
expect {
|
||||
@exchange[:name] = 'b r'
|
||||
}.to raise_error(Puppet::Error, /Valid values match/)
|
||||
end
|
||||
it 'should not allow names without @' do
|
||||
expect {
|
||||
@exchange[:name] = 'b_r'
|
||||
}.to raise_error(Puppet::Error, /Valid values match/)
|
||||
end
|
||||
|
||||
it 'should accept an exchange type' do
|
||||
@exchange[:type] = :direct
|
||||
@exchange[:type].should == :direct
|
||||
end
|
||||
it 'should require a type' do
|
||||
expect {
|
||||
Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar')
|
||||
}.to raise_error(/.*must set type when creating exchange.*/)
|
||||
end
|
||||
it 'should not require a type when destroying' do
|
||||
expect {
|
||||
Puppet::Type.type(:rabbitmq_exchange).new(:name => 'foo@bar', :ensure => :absent)
|
||||
}.to_not raise_error
|
||||
end
|
||||
|
||||
it 'should accept a user' do
|
||||
@exchange[:user] = :root
|
||||
@exchange[:user].should == :root
|
||||
end
|
||||
|
||||
it 'should accept a password' do
|
||||
@exchange[:password] = :PaSsw0rD
|
||||
@exchange[:password].should == :PaSsw0rD
|
||||
end
|
||||
end
|
@@ -0,0 +1,55 @@
|
||||
require 'puppet'
|
||||
require 'puppet/type/rabbitmq_user_permissions'
|
||||
describe Puppet::Type.type(:rabbitmq_user_permissions) do
|
||||
before :each do
|
||||
@perms = Puppet::Type.type(:rabbitmq_user_permissions).new(:name => 'foo@bar')
|
||||
end
|
||||
it 'should accept a valid hostname name' do
|
||||
@perms[:name] = 'dan@bar'
|
||||
@perms[:name].should == 'dan@bar'
|
||||
end
|
||||
it 'should require a name' do
|
||||
expect {
|
||||
Puppet::Type.type(:rabbitmq_user_permissions).new({})
|
||||
}.to raise_error(Puppet::Error, 'Title or name must be provided')
|
||||
end
|
||||
it 'should fail when names dont have a @' do
|
||||
expect {
|
||||
@perms[:name] = 'bar'
|
||||
}.to raise_error(Puppet::Error, /Valid values match/)
|
||||
end
|
||||
[:configure_permission, :read_permission, :write_permission].each do |param|
|
||||
it 'should not default to anything' do
|
||||
@perms[param].should == nil
|
||||
end
|
||||
it "should accept a valid regex for #{param}" do
|
||||
@perms[param] = '.*?'
|
||||
@perms[param].should == '.*?'
|
||||
end
|
||||
it "should accept an empty string for #{param}" do
|
||||
@perms[param] = ''
|
||||
@perms[param].should == ''
|
||||
end
|
||||
it "should not accept invalid regex for #{param}" do
|
||||
expect {
|
||||
@perms[param] = '*'
|
||||
}.to raise_error(Puppet::Error, /Invalid regexp/)
|
||||
end
|
||||
end
|
||||
{:rabbitmq_vhost => 'dan@test', :rabbitmq_user => 'test@dan'}.each do |k,v|
|
||||
it "should autorequire #{k}" do
|
||||
if k == :rabbitmq_vhost
|
||||
vhost = Puppet::Type.type(k).new(:name => "test")
|
||||
else
|
||||
vhost = Puppet::Type.type(k).new(:name => "test", :password => 'pass')
|
||||
end
|
||||
perm = Puppet::Type.type(:rabbitmq_user_permissions).new(:name => v)
|
||||
config = Puppet::Resource::Catalog.new :testing do |conf|
|
||||
[vhost, perm].each { |resource| conf.add_resource resource }
|
||||
end
|
||||
rel = perm.autorequire[0]
|
||||
rel.source.ref.should == vhost.ref
|
||||
rel.target.ref.should == perm.ref
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,42 @@
|
||||
require 'puppet'
|
||||
require 'puppet/type/rabbitmq_user'
|
||||
describe Puppet::Type.type(:rabbitmq_user) do
|
||||
before :each do
|
||||
@user = Puppet::Type.type(:rabbitmq_user).new(:name => 'foo', :password => 'pass')
|
||||
end
|
||||
it 'should accept a user name' do
|
||||
@user[:name] = 'dan'
|
||||
@user[:name].should == 'dan'
|
||||
@user[:admin].should == :false
|
||||
end
|
||||
it 'should accept a password' do
|
||||
@user[:password] = 'foo'
|
||||
@user[:password].should == 'foo'
|
||||
end
|
||||
it 'should require a password' do
|
||||
expect {
|
||||
Puppet::Type.type(:rabbitmq_user).new(:name => 'foo')
|
||||
}.to raise_error(/must set password/)
|
||||
end
|
||||
it 'should require a name' do
|
||||
expect {
|
||||
Puppet::Type.type(:rabbitmq_user).new({})
|
||||
}.to raise_error(Puppet::Error, 'Title or name must be provided')
|
||||
end
|
||||
it 'should not allow whitespace in the name' do
|
||||
expect {
|
||||
@user[:name] = 'b r'
|
||||
}.to raise_error(Puppet::Error, /Valid values match/)
|
||||
end
|
||||
[true, false, 'true', 'false'].each do |val|
|
||||
it "admin property should accept #{val}" do
|
||||
@user[:admin] = val
|
||||
@user[:admin].should == val.to_s.to_sym
|
||||
end
|
||||
end
|
||||
it 'should not accept non-boolean values for admin' do
|
||||
expect {
|
||||
@user[:admin] = 'yes'
|
||||
}.to raise_error(Puppet::Error, /Invalid value/)
|
||||
end
|
||||
end
|
@@ -0,0 +1,21 @@
|
||||
require 'puppet'
|
||||
require 'puppet/type/rabbitmq_vhost'
|
||||
describe Puppet::Type.type(:rabbitmq_vhost) do
|
||||
before :each do
|
||||
@vhost = Puppet::Type.type(:rabbitmq_vhost).new(:name => 'foo')
|
||||
end
|
||||
it 'should accept a vhost name' do
|
||||
@vhost[:name] = 'dan'
|
||||
@vhost[:name].should == 'dan'
|
||||
end
|
||||
it 'should require a name' do
|
||||
expect {
|
||||
Puppet::Type.type(:rabbitmq_vhost).new({})
|
||||
}.to raise_error(Puppet::Error, 'Title or name must be provided')
|
||||
end
|
||||
it 'should not allow whitespace in the name' do
|
||||
expect {
|
||||
@vhost[:name] = 'b r'
|
||||
}.to raise_error(Puppet::Error, /Valid values match/)
|
||||
end
|
||||
end
|
@@ -0,0 +1,23 @@
|
||||
Templates
|
||||
=========
|
||||
|
||||
Puppet supports templates and templating via ERB, which is part of the Ruby
|
||||
standard library and is used for many other projects including Ruby on Rails.
|
||||
Templates allow you to manage the content of template files, for example
|
||||
configuration files that cannot yet be managed as a Puppet type. Learn more at
|
||||
http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Templating
|
||||
|
||||
You can use templates like this:
|
||||
|
||||
class myclass {
|
||||
package { mypackage: ensure => latest }
|
||||
service { myservice: ensure => running }
|
||||
file { "/etc/myfile":
|
||||
content => template("mymodule/myfile.erb")
|
||||
}
|
||||
}
|
||||
|
||||
The templates are searched for in:
|
||||
|
||||
$templatedir/mymodule/myfile.erb
|
||||
$modulepath/mymodule/templates/myfile.erb
|
@@ -0,0 +1,5 @@
|
||||
<%- @environment_variables.keys.sort.each do |key| -%>
|
||||
<%- if @environment_variables[key] != 'UNSET' -%>
|
||||
<%= key %>=<%= @environment_variables[key] %>
|
||||
<%- end -%>
|
||||
<%- end -%>
|
@@ -0,0 +1,56 @@
|
||||
% This file managed by Puppet
|
||||
% Template Path: <%= @module_name %>/templates/rabbitmq.config
|
||||
[
|
||||
{rabbit, [
|
||||
<% if @ldap_auth -%>
|
||||
{auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},
|
||||
<% end -%>
|
||||
<% if @config_cluster -%>
|
||||
{cluster_nodes, {[<%= @r_cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}},
|
||||
{cluster_partition_handling, <%= @cluster_partition_handling %>},
|
||||
<% end -%>
|
||||
<%- if @ssl_only -%>
|
||||
{tcp_listeners, []},
|
||||
<%- end -%>
|
||||
<%- if @ssl -%>
|
||||
{ssl_listeners, [<%= @ssl_management_port %>]},
|
||||
{ssl_options, [{cacertfile,"<%= @ssl_cacert %>"},
|
||||
{certfile,"<%= @ssl_cert %>"},
|
||||
{keyfile,"<%= @ssl_key %>"},
|
||||
{verify,<%= @ssl_verify %>},
|
||||
{fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>}]},
|
||||
<%- end -%>
|
||||
<% if @config_variables -%>
|
||||
<%- @config_variables.keys.sort.each do |key| -%>
|
||||
{<%= key %>, <%= @config_variables[key] %>},
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
{default_user, <<"<%= @default_user %>">>},
|
||||
{default_pass, <<"<%= @default_pass %>">>}
|
||||
]}<% if @config_kernel_variables -%>,
|
||||
{kernel, [
|
||||
<%= @config_kernel_variables.sort.map{|k,v| "{#{k}, #{v}}"}.join(",\n ") %>
|
||||
]}
|
||||
<%- end -%>
|
||||
<% if @config_stomp -%>,
|
||||
% Configure the Stomp Plugin listening port
|
||||
{rabbitmq_stomp, [
|
||||
{tcp_listeners, [<%= @stomp_port %>]}
|
||||
<%- if @ssl_stomp_port -%>,
|
||||
{ssl_listeners, [<%= @ssl_stomp_port %>]}
|
||||
<%- end -%>
|
||||
]}
|
||||
<% end -%>
|
||||
<%- if @ldap_auth -%>,
|
||||
% Configure the LDAP authentication plugin
|
||||
{rabbitmq_auth_backend_ldap, [
|
||||
{other_bind, anon},
|
||||
{servers, ["<%= @ldap_server %>"]},
|
||||
{user_dn_pattern, "<%= @ldap_user_dn_pattern %>"},
|
||||
{use_ssl, <%= @ldap_use_ssl %>},
|
||||
{port, <%= @ldap_port %>},
|
||||
{log, <%= @ldap_log %>}
|
||||
]}
|
||||
<%- end -%>
|
||||
].
|
||||
% EOF
|
@@ -0,0 +1,5 @@
|
||||
# install first the garethr-erlang module. See README.md
|
||||
include 'erlang'
|
||||
|
||||
class { 'erlang': epel_enable => true}
|
||||
Class['erlang'] -> Class['rabbitmq']
|
21
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/full.pp
vendored
Normal file
21
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/full.pp
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
class { 'rabbitmq::repo::apt':
|
||||
pin => '900',
|
||||
}->
|
||||
class { 'rabbitmq::server':
|
||||
delete_guest_user => true,
|
||||
# version => '2.4.1',
|
||||
}->
|
||||
rabbitmq_user { 'dan':
|
||||
admin => true,
|
||||
password => 'pass',
|
||||
provider => 'rabbitmqctl',
|
||||
}->
|
||||
rabbitmq_vhost { 'myhost':
|
||||
provider => 'rabbitmqctl',
|
||||
}
|
||||
rabbitmq_user_permissions { 'dan@myhost':
|
||||
configure_permission => '.*',
|
||||
read_permission => '.*',
|
||||
write_permission => '.*',
|
||||
provider => 'rabbitmqctl',
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
rabbitmq_user { 'blah7':
|
||||
password => 'foo',
|
||||
}
|
||||
rabbitmq_vhost { 'test5': }
|
||||
rabbitmq_user_permissions { 'blah7@test5':
|
||||
configure_permission => 'config2',
|
||||
read_permission => 'ready',
|
||||
#write_permission => 'ready',
|
||||
}
|
11
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/plugin.pp
vendored
Normal file
11
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/plugin.pp
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
class { 'rabbitmq::server':
|
||||
config_stomp => true,
|
||||
}
|
||||
|
||||
$rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
|
||||
|
||||
rabbitmq_plugin { $rabbitmq_plugins:
|
||||
ensure => present,
|
||||
require => Class['rabbitmq::server'],
|
||||
provider => 'rabbitmqplugins',
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
# requires pupetlabs-apt
|
||||
include rabbitmq::repo::apt
|
5
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/server.pp
vendored
Normal file
5
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/server.pp
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
class { 'rabbitmq::server':
|
||||
port => '5672',
|
||||
delete_guest_user => true,
|
||||
version => 'latest',
|
||||
}
|
@@ -0,0 +1 @@
|
||||
class { 'rabbitmq::service': }
|
16
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/site.pp
vendored
Normal file
16
resources/vagrant/vms/phraseanet-php55-nginx/puphpet/puppet/modules/rabbitmq/tests/site.pp
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
node default {
|
||||
|
||||
$rabbitmq_plugins = [ 'amqp_client', 'rabbitmq_stomp' ]
|
||||
|
||||
class { 'rabbitmq::server':
|
||||
config => '[ {rabbit_stomp, [{tcp_listeners, [1234]} ]} ].',
|
||||
}
|
||||
|
||||
# Required for MCollective
|
||||
rabbitmq_plugin { $rabbitmq_plugins:
|
||||
ensure => present,
|
||||
require => Class['rabbitmq::server'],
|
||||
provider => 'rabbitmqplugins',
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,4 @@
|
||||
rabbitmq_user { ['blah2', 'blah3', 'blah4']:
|
||||
password => 'phoey!',
|
||||
#provider => 'rabbitmqctl',
|
||||
}
|
@@ -0,0 +1 @@
|
||||
rabbitmq_vhost { ['fooey', 'blah']: }
|
Reference in New Issue
Block a user