Playbook that installs and configures RabbitMQ message broker.
Supports standalone or simple cluster deployment, it is based on Mayeu.RabbitMQ role, without SSL or federation support.
Use Ansible galaxy to install this playbook:
$ ansible-galaxy install openstack-ansible-galaxy.rabbitmq
Ubuntu 14.04 (Trusty), Ubuntu 16.04 (Xenial), Ubuntu 18.04 (Bionic) and CentOS 7.x
Use rabbitmq_conf_env
so set Environment variables such as NODENAME,
HOSTNAME, RABBITMQ_USE_LONGNAME, NODE_PORT, NODE_IP_ADDRESS, etc.
Example:
rabbitmq_conf_env:
NODENAME: rabbit1
rabbitmq_tcp_address
- listening address for the tcp interface, such
as 0.0.0.0
.
rabbitmq_tcp_port
- listening port for the tcp interface, such as 5672
.
rabbitmq_cluster
- a boolean variable, when set to True
the role will add
all nodes in a play group to a cluster setup in a configuration file. It
depends on a ansible_play_hosts
magic variable, found in ansible 2.2
or later.
rabbitmq_erlang_cookie
- only used when rabbitmq_cluster
is used, to
identify members of a single cluster.
rabbitmq_plugins
- list of plugins to activate.
rabbitmq_users
- list of users, and associated vhost and password.
Example on defining the users configuration:
rabbitmq_users:
- user: user1
password: password1 # Optional, defaults to ""
vhost: vhost1 # Optional, defaults to "/"
node: node_name # Optional, defaults to "rabbit"
configure_priv: "^resource.*" # Optional, defaults to ".*"
read_priv: "^$" # Disallow reading (defaults to ".*")
write_priv: "^$" # Disallow writing (defaults to ".*")
- user: user2
password: password2
vhost: vhost1
force: no
tags: # Optional, user tags
- administrator
- user: guest
state: absent # Optional, removes user (defaults to "present")
rabbitmq_vhosts
- list of vhosts to create. Example on defining the
vhosts configuration:
rabbitmq_vhosts:
- name: vhost1
node: node_name # Optional, defaults to "rabbit"
tracing: yes # Optional, defaults to "no"
state: present # Optional, defaults to "present"
rabbitmq_policies
- list of policies to be created (or removed if
state: absent
is set). Example on defining the policies configuration:
rabbitmq_policies:
- name: HA Policy
vhost: '/' # Optional, defaults to "/"
pattern: '.*' # Optional, defaults to ".*"
tags: # Optional, defaults to "{}"
ha-mode: all
ha-sync-mode: automatic
state: present # Optional, defaults to "present"
This role supports setting up a simple cluster by adding all the nodes in a
play group that uses the role. It adds the nodes to cluster_nodes
section
in rabbitmq.conf file. All the nodes are disc
nodes. The role also sets the
same "Erlang Cookie" to all the nodes belonging to a cluster. In this way
nodes join the cluster automatically during the bootstrap.
For the initial deployment, it is advised to serialize the node deployment in a way that, at first, a single node is deployed, followed by all the other nodes in the second run. This would result in a consistent cluster setup. Playbook example:
- hosts: rabbitmq
become: True
serial:
- 1
- '100%'
roles:
- rabbitmq
rabbitmq_fd_limit
- set this to some numeric value to override 1024
default. Currently only supports systemd.
There is some tests that try to provision a VM using Vagrant. Just launch them with:
$ cd tests
$ vagrant up
BSD