diff options
-rw-r--r-- | README.md | 76 | ||||
-rw-r--r-- | defaults/main.yml | 12 | ||||
-rw-r--r-- | handlers/main.yml | 2 | ||||
-rw-r--r-- | tasks/debian.yml | 6 | ||||
-rw-r--r-- | tasks/main.yml | 3 | ||||
-rw-r--r-- | tasks/rabbitmq_ha_config.yml | 18 |
6 files changed, 57 insertions, 60 deletions
@@ -1,65 +1,73 @@ | |||
1 | Role Name | 1 | <!-- START doctoc generated TOC please keep comment here to allow auto update --> |
2 | ========= | 2 | <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
3 | **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* | ||
3 | 4 | ||
4 | An [Ansible] role to install/configure [RabbitMQ] | 5 | - [ansible-rabbitmq](#ansible-rabbitmq) |
6 | - [Build Status](#build-status) | ||
7 | - [Requirements](#requirements) | ||
8 | - [Vagrant](#vagrant) | ||
9 | - [Role Variables](#role-variables) | ||
10 | - [Dependencies](#dependencies) | ||
11 | - [Example Playbook](#example-playbook) | ||
12 | - [License](#license) | ||
13 | - [Author Information](#author-information) | ||
5 | 14 | ||
6 | Build Status | 15 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> |
7 | ------------ | 16 | |
17 | # ansible-rabbitmq | ||
18 | |||
19 | An [Ansible](https://www.ansible.com) role to install/configure [RabbitMQ](https://www.rabbitmq.com/) | ||
20 | |||
21 | ## Build Status | ||
8 | 22 | ||
9 | [![Build Status](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq.svg?branch=master)](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq) | 23 | [![Build Status](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq.svg?branch=master)](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq) |
10 | 24 | ||
11 | Requirements | 25 | ## Requirements |
12 | ------------ | ||
13 | 26 | ||
14 | Ensure hostnames are resolvable prior to clustering...either update /etc/hosts | 27 | Ensure hostnames are resolvable prior to clustering...either update /etc/hosts |
15 | or ensure DNS is working. | 28 | or ensure DNS is working. |
16 | 29 | ||
17 | Vagrant | 30 | ## Vagrant |
18 | ------- | ||
19 | 31 | ||
20 | Spin up a 3 node HA Cluster for testing... | 32 | Spin up a 3 node HA Cluster for testing... |
21 | Install Ansible role on your host: | 33 | Install Ansible role on your host: |
22 | ``` | 34 | |
35 | ```bash | ||
23 | sudo ansible-galaxy install -r requirements.yml -f | 36 | sudo ansible-galaxy install -r requirements.yml -f |
24 | ``` | 37 | ``` |
25 | Now spin up your environment... | 38 | |
26 | ``` | 39 | Now spin up your environment... |
40 | |||
41 | ```bash | ||
27 | vagrant up | 42 | vagrant up |
28 | ``` | 43 | ``` |
29 | When you are done testing, tear it all down... | 44 | |
30 | ``` | 45 | When you are done testing, tear it all down... |
46 | |||
47 | ```bash | ||
31 | ./cleanup.sh | 48 | ./cleanup.sh |
32 | ``` | 49 | ``` |
33 | 50 | ||
34 | Role Variables | 51 | ## Role Variables |
35 | -------------- | ||
36 | 52 | ||
37 | [Role Defaults](./defaults/main.yml) | 53 | [Role Defaults](./defaults/main.yml) |
38 | 54 | ||
39 | Dependencies | 55 | ## Dependencies |
40 | ------------ | ||
41 | 56 | ||
42 | None | 57 | None |
43 | 58 | ||
44 | Example Playbook | 59 | ## Example Playbook |
45 | ---------------- | ||
46 | 60 | ||
47 | [Example Playbook](./playbook.yml) | 61 | [Example Playbook](./playbook.yml) |
48 | 62 | ||
49 | License | 63 | ## License |
50 | ------- | ||
51 | 64 | ||
52 | BSD | 65 | MIT |
53 | 66 | ||
54 | Author Information | 67 | ## Author Information |
55 | ------------------ | ||
56 | 68 | ||
57 | Larry Smith Jr. | 69 | Larry Smith Jr. |
58 | - [@mrlesmithjr] | ||
59 | - http://everythingshouldbevirtual.com | ||
60 | - mrlesmithjr [at] gmail.com | ||
61 | |||
62 | [@mrlesmithjr]: <https://www.twitter.com/mrlesmithjr> | ||
63 | 70 | ||
64 | [Ansible]: <https://www.ansible.com> | 71 | - [@mrlesmithjr](https://www.twitter.com/mrlesmithjr) |
65 | [RabbitMQ]: <https://www.rabbitmq.com/> | 72 | - [EverythingShouldBeVirtual](http://everythingshouldbevirtual.com) |
73 | - [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com) | ||
diff --git a/defaults/main.yml b/defaults/main.yml index dcea8b9..ff7d922 100644 --- a/defaults/main.yml +++ b/defaults/main.yml | |||
@@ -12,15 +12,15 @@ rabbitmq_config: [] | |||
12 | rabbitmq_config_ha: false | 12 | rabbitmq_config_ha: false |
13 | 13 | ||
14 | rabbitmq_config_service: false | 14 | rabbitmq_config_service: false |
15 | rabbitmq_config_file: 'etc/rabbitmq/rabbitmq.config.j2' | 15 | rabbitmq_config_file: etc/rabbitmq/rabbitmq.config.j2 |
16 | 16 | ||
17 | rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main' | 17 | # rabbitmq_debian_repo: deb http://www.rabbitmq.com/debian/ testing main |
18 | #other repos | 18 | #other repos |
19 | #rabbitmq_debian_repo: deb https://dl.bintray.com/rabbitmq/debian {{ ansible_distribution_release }} main #bintray | 19 | rabbitmq_debian_repo: "deb https://dl.bintray.com/rabbitmq/debian {{ ansible_distribution_release }} main #bintray" |
20 | rabbitmq_debian_repo_key: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc' | 20 | # rabbitmq_debian_repo_key: https://www.rabbitmq.com/rabbitmq-release-signing-key.asc |
21 | #rabbitmq_debian_repo_key: https://bintray.com/user/downloadSubjectPublicKey?username=rabbitmq | 21 | rabbitmq_debian_repo_key: https://bintray.com/user/downloadSubjectPublicKey?username=rabbitmq |
22 | rabbitmq_debian_erlang_from_rabbit: false | 22 | rabbitmq_debian_erlang_from_rabbit: false |
23 | #rabbitmq_debian_version: 3.7.9 # current version if not defined | 23 | rabbitmq_debian_version: 3.7.9 # current version if not defined |
24 | 24 | ||
25 | # Defines if setting up a rabbitmq cluster | 25 | # Defines if setting up a rabbitmq cluster |
26 | rabbitmq_enable_clustering: false | 26 | rabbitmq_enable_clustering: false |
diff --git a/handlers/main.yml b/handlers/main.yml index 4fdafe5..c727c75 100644 --- a/handlers/main.yml +++ b/handlers/main.yml | |||
@@ -2,6 +2,6 @@ | |||
2 | # handlers file for ansible-rabbitmq | 2 | # handlers file for ansible-rabbitmq |
3 | - name: restart rabbitmq-server | 3 | - name: restart rabbitmq-server |
4 | service: | 4 | service: |
5 | name: "rabbitmq-server" | 5 | name: rabbitmq-server |
6 | state: restarted | 6 | state: restarted |
7 | become: true | 7 | become: true |
diff --git a/tasks/debian.yml b/tasks/debian.yml index c98ff68..317932e 100644 --- a/tasks/debian.yml +++ b/tasks/debian.yml | |||
@@ -20,6 +20,8 @@ | |||
20 | url: https://bintray.com/user/downloadSubjectPublicKey?username=rabbitmq-erlang | 20 | url: https://bintray.com/user/downloadSubjectPublicKey?username=rabbitmq-erlang |
21 | state: present | 21 | state: present |
22 | become: true | 22 | become: true |
23 | register: result | ||
24 | until: result is successful | ||
23 | when: rabbitmq_debian_erlang_from_rabbit | 25 | when: rabbitmq_debian_erlang_from_rabbit |
24 | 26 | ||
25 | - name: debian | add Rabbitmq erlang repo | 27 | - name: debian | add Rabbitmq erlang repo |
@@ -34,8 +36,10 @@ | |||
34 | name: ['rabbitmq-server'] | 36 | name: ['rabbitmq-server'] |
35 | state: present | 37 | state: present |
36 | become: true | 38 | become: true |
39 | register: result | ||
40 | until: result is successful | ||
37 | with_items: | 41 | with_items: |
38 | - rabbitmq-server{{ (rabbitmq_debian_version is defined) | ternary(['=',rabbitmq_debian_version] | join(''),'')}} | 42 | - rabbitmq-server{{ (rabbitmq_debian_version is defined) | ternary(['=',rabbitmq_debian_version] | join(''),'') }} |
39 | 43 | ||
40 | - name: debian | enabling the RabbitMQ Management Console | 44 | - name: debian | enabling the RabbitMQ Management Console |
41 | rabbitmq_plugin: | 45 | rabbitmq_plugin: |
diff --git a/tasks/main.yml b/tasks/main.yml index 8905c0b..3205473 100644 --- a/tasks/main.yml +++ b/tasks/main.yml | |||
@@ -15,7 +15,8 @@ | |||
15 | when: rabbitmq_config_service | 15 | when: rabbitmq_config_service |
16 | 16 | ||
17 | - name: checking to see if already clustered | 17 | - name: checking to see if already clustered |
18 | stat: path=/etc/rabbitmq/clustered | 18 | stat: |
19 | path: /etc/rabbitmq/clustered | ||
19 | become: true | 20 | become: true |
20 | register: clustered | 21 | register: clustered |
21 | 22 | ||
diff --git a/tasks/rabbitmq_ha_config.yml b/tasks/rabbitmq_ha_config.yml index d3e4aa2..0048b0c 100644 --- a/tasks/rabbitmq_ha_config.yml +++ b/tasks/rabbitmq_ha_config.yml | |||
@@ -13,22 +13,6 @@ | |||
13 | notify: restart rabbitmq-server | 13 | notify: restart rabbitmq-server |
14 | when: not rabbitmqadmin_check['stat']['exists'] | 14 | when: not rabbitmqadmin_check['stat']['exists'] |
15 | 15 | ||
16 | # - name: rabbitmq_ha_config | install rabbitMQ admin | ||
17 | # shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin | ||
18 | # become: true | ||
19 | # when: not rabbitmqadmin_check['stat']['exists'] | ||
20 | |||
21 | # - name: rabbitmq_ha_config | moving the rabbitMQ Admin | ||
22 | # shell: mv rabbitmqadmin /usr/sbin | ||
23 | # become: true | ||
24 | # when: not rabbitmqadmin_check['stat']['exists'] | ||
25 | |||
26 | # - name: rabbitmq_ha_config | making executable rabbitMQ Admin | ||
27 | # shell: chmod +x /usr/sbin/rabbitmqadmin | ||
28 | # notify: restart rabbitmq-server | ||
29 | # become: true | ||
30 | # when: not rabbitmqadmin_check['stat']['exists'] | ||
31 | |||
32 | - name: rabbitmq_ha_config | creating queue(s) | 16 | - name: rabbitmq_ha_config | creating queue(s) |
33 | command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} | 17 | command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} |
34 | run_once: true | 18 | run_once: true |
@@ -37,7 +21,7 @@ | |||
37 | 21 | ||
38 | - name: rabbitmq_ha_config | setting up ha on queue(s) | 22 | - name: rabbitmq_ha_config | setting up ha on queue(s) |
39 | rabbitmq_policy: | 23 | rabbitmq_policy: |
40 | name: "ha-all" | 24 | name: ha-all |
41 | pattern: "{{ item['queue_name'] }}" | 25 | pattern: "{{ item['queue_name'] }}" |
42 | tags: "{{ item['tags'] }}" | 26 | tags: "{{ item['tags'] }}" |
43 | state: present | 27 | state: present |