silverlogic.rabbitmq
Announcement
It's been a while since the last update. I'm back to work on this playbook! I will be merging fixes (like URL updates and key checks) into the master branch and releasing a stable version.
After that, I will focus on creating a new branch for version 2.0 of this playbook. In version 2, I plan to separate the installation steps from the configuration. I don't want to maintain support for too many operating systems in a single playbook. So, you'll have the freedom to create your own ansible-playbook-rabbitmq-install-my-own-os
:)
Thank you all for your contributions!
RabbitMQ Playbook
This playbook helps install and configure RabbitMQ. More configuration options will be added later.
If you want to discuss changes or help add support for more platforms, please open an issue.
Installation
To install this playbook, use Ansible Galaxy:
$ ansible-galaxy install Mayeu.RabbitMQ,1.4.0
The master
branch may not be stable at the moment. Please use it only for testing!
Supported Systems
Currently, only Debian Jessie and Wheezy on amd64 are supported. Contributions are welcome to support other distributions or operating systems.
Semantic Versioning 2.0.0
Starting with commit 67c608826a140868a71854ce3129b5f3d67ddcce, this playbook follows semantic versioning. Since the playbook is used in production, the first version number will be 1.0.0 to avoid breaking compatibility.
The public API referred to in semantic versioning shows the settings available to users. If we break the API by changing the version from X.Y.Z
to (X+1).Y.Z
, users will need to update variable names in their playbooks to keep them working.
Any new feature added (from X.Y.Z
to X.(Y+1).Z
) will have a default value that requires no user interaction. If a new feature needs user input, it counts as a major upgrade.
Role Variables
Installation
Name | Type | Description | Default |
---|---|---|---|
rabbitmq_os_package |
Bool | If true, use the default package from the OS instead of RabbitMQ's. | false |
Environment
Name | Type | Description | Default |
---|---|---|---|
rabbitmq_conf_env |
Hash | Set environment variables | undef |
Example:
rabbitmq_conf_env:
RABBITMQ_ROCKS: correct
This will generate:
RABBITMQ_ROCKS="correct"
Certificates
Name | Type | Description | Default |
---|---|---|---|
rabbitmq_cacert |
String | Path to the CA certificate file | files/rabbitmq_cacert.pem |
rabbitmq_server_key |
String | Path to the SSL key file | files/rabbitmq_server_key.pem |
rabbitmq_server_cert |
String | Path to the SSL certificate file | files/rabbitmq_server_cert.pem |
rabbitmq_ssl |
Bool | Whether to use SSL | true |
Default Configuration File
Name | Type | Description | Default |
---|---|---|---|
rabbitmq_conf_tcp_listeners_address |
String | TCP interface listening address | '' |
rabbitmq_conf_tcp_listeners_port |
Integer | TCP interface listening port | 5672 |
rabbitmq_conf_ssl_listeners_address |
String | SSL interface listening address | '0.0.0.0' |
rabbitmq_conf_ssl_listeners_port |
Integer | SSL interface listening port | 5671 |
rabbitmq_conf_ssl_options_cacertfile |
String | Path to the CA certificate | "/etc/rabbitmq/ssl/cacert.pem" |
rabbitmq_conf_ssl_options_certfile |
String | Path to the server certificate | "/etc/rabbitmq/ssl/server_cert.pem" |
rabbitmq_conf_ssl_options_keyfile |
String | Path to the private key file | "/etc/rabbitmq/ssl/server_key.pem" |
rabbitmq_conf_ssl_options_fail_if_no_peer_cert |
Bool | SSL option value for fail_if_no_peer_cert |
"true" |
Plugins
Name | Type | Description | Default |
---|---|---|---|
rabbitmq_new_only |
String | Add plugins without deactivating others | 'no' |
rabbitmq_plugins |
String | List of plugins to activate | [] |
Vhost
Name | Type | Description | Default |
---|---|---|---|
rabbitmq_vhost_definitions |
List | List of vhosts to create | [] |
rabbitmq_users_definitions |
List of hashes | Define users with associated vhost and password | [] |
Defining Vhosts:
rabbitmq_vhost_definitions:
- name: vhost1
node: node_name # Optional, defaults to "rabbit"
tracing: yes # Optional, defaults to "no"
Defining Users:
rabbitmq_users_definitions:
- vhost: vhost1
user: user1
password: password1
node: node_name # Optional, defaults to "rabbit"
configure_priv: "^resource.*" # Optional, defaults to ".*"
read_priv: "^$" # No read access.
write_priv: "^$" # No write access.
- vhost: vhost1
user: user2
password: password2
force: no
tags: # Optional user tags
- administrator
Federation
Name | Type | Description | Default |
---|---|---|---|
rabbitmq_federation |
Bool | Whether to set up federation | false |
rabbitmq_federation_configuration |
List of hashes | Federation setup configuration | Not defined |
rabbitmq_policy_configuration |
List of hashes | Policy configuration for federation | Not defined |
Defining the upstream federation configuration:
rabbitmq_federation_upstream:
- name: upstream name
vhost: local vhost to federate
value: json description of the federation
local_username: local username for the federation
Refer to the RabbitMQ documentation for details on valid JSON values.
Defining policy configuration:
rabbitmq_policy_configuration:
- name: name of the policy
vhost: vhost where the policy will apply
pattern: pattern of the policy
tags: description of the policy in dict form # e.g., "ha-mode=all"
Required Files
You need to place the necessary certificates in your files/
folder, for example:
files/
|- cacert.crt
|- myserver_key.key
|- myserver_cert.crt
Then configure the role:
rabbitmq_cacert: files/cacert.crt
rabbitmq_server_key: files/myserver_key.key
rabbitmq_server_cert: files/myserver_cert.crt
Testing
There are tests available that try to set up a VM using Vagrant. You can launch them with:
$ vagrant up # for testing with Debian Jessie
$ export VAGRANT_BOX_NAME='chef/centos-6.5' vagrant up # for testing with CentOS
You can change the VM used during testing by setting the VAGRANT_BOX_NAME
environment variable to another value instead of deb/jessie
.
License
BSD
RabbitMQ is a complete and highly reliable enterprise messaging system based on the emerging AMQP standard.
ansible-galaxy install silverlogic.rabbitmq