Skip to content

Commit

Permalink
Support EL 7 and RabbitMQ 3.7+
Browse files Browse the repository at this point in the history
  • Loading branch information
tanadeau committed Aug 21, 2018
1 parent 8448052 commit 355cfd2
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 128 deletions.
47 changes: 19 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# RabbitMQ Ansible Role
Forked from https://github.com/jasonroyle/ansible-role-rabbitmq on 2018-08-20
to support EL 7 and RabbitMQ 3.7+.

## Version

Expand All @@ -9,7 +11,7 @@ See:
Set the `rabbitmq_version` variable to define the version of RabbitMQ to install.

```yaml
rabbitmq_version: 3.6.6-1
rabbitmq_version: '3.7.7'
```
## Users
Expand All @@ -23,9 +25,9 @@ Set the `rabbitmq_users` variable to define an array of present users.

```yaml
rabbitmq_users:
- user: admin
password: admin
tags: administrator
- user: admin
password: admin
tags: administrator
```

| parameter | required | default | choices | comments |
Expand All @@ -44,7 +46,7 @@ Set the `rabbitmq_users_absent` variable to define an array of absent users.

```yaml
rabbitmq_users_absent:
- guest
- guest
```

## Virtual Hosts
Expand All @@ -58,10 +60,10 @@ Set the `rabbitmq_vhosts` variable to define an array of present virtual hosts.

```yaml
rabbitmq_vhosts:
- /one
- name: /two
node: rabbit
tracing: no
- /one
- name: /two
node: rabbit
tracing: no
```

| parameter | required | default | choices | comments |
Expand All @@ -76,7 +78,7 @@ Set the `rabbitmq_vhosts_absent` variable to define an array of absent virtual h

```yaml
rabbitmq_vhosts_absent:
- /vhost
- /vhost
```

## Plugins
Expand All @@ -90,9 +92,9 @@ Set the `rabbitmq_plugins` variable to define an array of enabled plugins.

```yaml
rabbitmq_plugins:
- rabbitmq_management
- name: rabbitmq_delayed_message_exchange
url: http://www.rabbitmq.com/community-plugins/v3.6.x/rabbitmq_delayed_message_exchange-0.0.1.ez
- rabbitmq_management
- name: rabbitmq_delayed_message_exchange
url: http://www.rabbitmq.com/community-plugins/v3.6.x/rabbitmq_delayed_message_exchange-0.0.1.ez
```

| parameter | required | default | choices | comments |
Expand All @@ -106,7 +108,7 @@ Set the `rabbitmq_plugins_disabled` variable to disable plugins.

```yaml
rabbitmq_plugins_disabled:
- rabbitmq_management
- rabbitmq_management
```

## Configuration
Expand All @@ -120,9 +122,9 @@ Set the `rabbitmq_config` variable to define the configuration.

```yaml
rabbitmq_config:
- rabbit:
- tcp_listeners:
- "'0.0.0.0'": 5671
- rabbit:
- tcp_listeners:
- "'0.0.0.0'": 5671
```

## Cluster
Expand All @@ -145,17 +147,6 @@ Set the `rabbitmq_erlang_cookie` variable to define the Erlang cookie.
rabbitmq_erlang_cookie: g9avtqdzdm2p5oe9
```

### IP Address

Set the `rabbitmq_cluster_ip_address` host variable to define the private IP address of each host.

```
[queue]
123.123.123.1 rabbitmq_cluster_ip_address=321.321.321.1
123.123.123.2 rabbitmq_cluster_ip_address=321.321.321.2
123.123.123.3 rabbitmq_cluster_ip_address=321.321.321.3
```
## License

MIT
21 changes: 8 additions & 13 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
---
rabbitmq_cluster: False

rabbitmq_cluster: false
rabbitmq_cluster_master: "rabbit@{{ hostvars[ansible_play_hosts.0].ansible_hostname }}"

rabbitmq_erlang_cookie_file: /var/lib/rabbitmq/.erlang.cookie

rabbitmq_plugin_dir: "/usr/lib/rabbitmq/lib/rabbitmq_server-{{ rabbitmq_version.split('-').0 }}/plugins"
rabbitmq_plugin_dir: "/usr/lib/rabbitmq/lib/rabbitmq_server-{{ rabbitmq_version }}/plugins"

rabbitmq_plugins:
- rabbitmq_management
- rabbitmq_management

rabbitmq_plugins_disabled: []

rabbitmq_users:
- user: admin
password: admin
tags: administrator
- user: admin
password: admin
tags: administrator

rabbitmq_users_absent:
- guest

rabbitmq_version: 3.6.6-1
- guest

rabbitmq_version: '3.7.7'
rabbitmq_vhosts: []

rabbitmq_vhosts_absent: []
23 changes: 9 additions & 14 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
---
galaxy_info:
author: jasonroyle
author: anthemengineering
description: RabbitMQ
license: MIT
min_ansible_version: 1.2
min_ansible_version: 2.0
platforms:
- name: EL
versions:
- 5
- 6
- 7
- name: Ubuntu
versions:
- trusty
- name: EL
versions:
- 7
galaxy_tags:
- rabbitmq
- amqp
- plugin
- cluster
- rabbitmq
- amqp
- plugin
- cluster

dependencies: []
25 changes: 0 additions & 25 deletions tasks/Debian/install.yml

This file was deleted.

38 changes: 0 additions & 38 deletions tasks/RedHat/install.yml

This file was deleted.

2 changes: 1 addition & 1 deletion tasks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- name: join rabbitmq cluster
shell: "rabbitmqctl join_cluster {{ rabbitmq_cluster_master }}"
register: rabbitmq_output
ignore_errors: True
ignore_errors: true

- name: ensure rabbitmq cluster member
fail: msg="Unable to join the cluster."
Expand Down
6 changes: 0 additions & 6 deletions tasks/configure-cluster.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
---
- name: add rabbitmq cluster hosts
lineinfile:
dest: /etc/hosts
line: "{{ hostvars[item].rabbitmq_cluster_ip_address | default(hostvars[item].ansible_default_ipv4.address) }} {{ hostvars[item].ansible_hostname }}"
with_items: "{{ ansible_play_hosts }}"

- name: set erlang cookie
template:
src: erlang.cookie.j2
Expand Down
17 changes: 17 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- name: Configure Erlang Yum repo
yum_repository:
name: rabbitmq-erlang
description: Erlang
baseurl: https://dl.bintray.com/rabbitmq/rpm/erlang/21/el/7
gpgcheck: true
gpgkey: https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
- name: Configure RabbitMQ Yum repo
yum_repository:
name: rabbitmq
description: RabbitMQ
baseurl: https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/7/
gpgcheck: false
- name: Install RabbitMQ
package:
name: rabbitmq-server-{{ rabbitmq_version }}
state: present
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
- include: rabbitmq.yml
tags:
- rabbitmq
- rabbitmq
4 changes: 2 additions & 2 deletions tasks/rabbitmq.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: include rabbitmq installation tasks
include: "{{ ansible_os_family }}/install.yml"
include: install.yml

- include: configure.yml

Expand All @@ -10,7 +10,7 @@
- name: start rabbitmq server
service:
name: rabbitmq-server
enabled: True
enabled: true
state: started

- include: vhosts.yml
Expand Down

0 comments on commit 355cfd2

Please sign in to comment.