-Role Name
-=========
+<!-- START doctoc generated TOC please keep comment here to allow auto update -->
+<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
+**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
-An [Ansible] role to install/configure [RabbitMQ]
+- [ansible-rabbitmq](#ansible-rabbitmq)
+ - [Build Status](#build-status)
+ - [Requirements](#requirements)
+ - [Vagrant](#vagrant)
+ - [Role Variables](#role-variables)
+ - [Dependencies](#dependencies)
+ - [Example Playbook](#example-playbook)
+ - [License](#license)
+ - [Author Information](#author-information)
-Build Status
-------------
+<!-- END doctoc generated TOC please keep comment here to allow auto update -->
+
+# ansible-rabbitmq
+
+An [Ansible](https://www.ansible.com) role to install/configure [RabbitMQ](https://www.rabbitmq.com/)
+
+## Build Status
[![Build Status](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq.svg?branch=master)](https://travis-ci.org/mrlesmithjr/ansible-rabbitmq)
-Requirements
-------------
+## Requirements
Ensure hostnames are resolvable prior to clustering...either update /etc/hosts
or ensure DNS is working.
-Vagrant
--------
+## Vagrant
-Spin up a 3 node HA Cluster for testing...
-Install Ansible role on your host:
-```
+Spin up a 3 node HA Cluster for testing...
+Install Ansible role on your host:
+
+```bash
sudo ansible-galaxy install -r requirements.yml -f
```
-Now spin up your environment...
-```
+
+Now spin up your environment...
+
+```bash
vagrant up
```
-When you are done testing, tear it all down...
-```
+
+When you are done testing, tear it all down...
+
+```bash
./cleanup.sh
```
-Role Variables
---------------
+## Role Variables
[Role Defaults](./defaults/main.yml)
-Dependencies
-------------
+## Dependencies
None
-Example Playbook
-----------------
+## Example Playbook
[Example Playbook](./playbook.yml)
-License
--------
+## License
-BSD
+MIT
-Author Information
-------------------
+## Author Information
Larry Smith Jr.
-- [@mrlesmithjr]
-- http://everythingshouldbevirtual.com
-- mrlesmithjr [at] gmail.com
-
-[@mrlesmithjr]: <https://www.twitter.com/mrlesmithjr>
-[Ansible]: <https://www.ansible.com>
-[RabbitMQ]: <https://www.rabbitmq.com/>
+- [@mrlesmithjr](https://www.twitter.com/mrlesmithjr)
+- [EverythingShouldBeVirtual](http://everythingshouldbevirtual.com)
+- [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com)
rabbitmq_config_ha: false
rabbitmq_config_service: false
-rabbitmq_config_file: 'etc/rabbitmq/rabbitmq.config.j2'
+rabbitmq_config_file: etc/rabbitmq/rabbitmq.config.j2
-rabbitmq_debian_repo: 'deb http://www.rabbitmq.com/debian/ testing main'
+# rabbitmq_debian_repo: deb http://www.rabbitmq.com/debian/ testing main
#other repos
-#rabbitmq_debian_repo: deb https://dl.bintray.com/rabbitmq/debian {{ ansible_distribution_release }} main #bintray
-rabbitmq_debian_repo_key: 'https://www.rabbitmq.com/rabbitmq-release-signing-key.asc'
-#rabbitmq_debian_repo_key: https://bintray.com/user/downloadSubjectPublicKey?username=rabbitmq
+rabbitmq_debian_repo: "deb https://dl.bintray.com/rabbitmq/debian {{ ansible_distribution_release }} main #bintray"
+# rabbitmq_debian_repo_key: https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
+rabbitmq_debian_repo_key: https://bintray.com/user/downloadSubjectPublicKey?username=rabbitmq
rabbitmq_debian_erlang_from_rabbit: false
-#rabbitmq_debian_version: 3.7.9 # current version if not defined
+rabbitmq_debian_version: 3.7.9 # current version if not defined
# Defines if setting up a rabbitmq cluster
rabbitmq_enable_clustering: false
# handlers file for ansible-rabbitmq
- name: restart rabbitmq-server
service:
- name: "rabbitmq-server"
+ name: rabbitmq-server
state: restarted
become: true
url: https://bintray.com/user/downloadSubjectPublicKey?username=rabbitmq-erlang
state: present
become: true
+ register: result
+ until: result is successful
when: rabbitmq_debian_erlang_from_rabbit
- name: debian | add Rabbitmq erlang repo
name: ['rabbitmq-server']
state: present
become: true
+ register: result
+ until: result is successful
with_items:
- - rabbitmq-server{{ (rabbitmq_debian_version is defined) | ternary(['=',rabbitmq_debian_version] | join(''),'')}}
+ - rabbitmq-server{{ (rabbitmq_debian_version is defined) | ternary(['=',rabbitmq_debian_version] | join(''),'') }}
- name: debian | enabling the RabbitMQ Management Console
rabbitmq_plugin:
when: rabbitmq_config_service
- name: checking to see if already clustered
- stat: path=/etc/rabbitmq/clustered
+ stat:
+ path: /etc/rabbitmq/clustered
become: true
register: clustered
notify: restart rabbitmq-server
when: not rabbitmqadmin_check['stat']['exists']
-# - name: rabbitmq_ha_config | install rabbitMQ admin
-# shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin
-# become: true
-# when: not rabbitmqadmin_check['stat']['exists']
-
-# - name: rabbitmq_ha_config | moving the rabbitMQ Admin
-# shell: mv rabbitmqadmin /usr/sbin
-# become: true
-# when: not rabbitmqadmin_check['stat']['exists']
-
-# - name: rabbitmq_ha_config | making executable rabbitMQ Admin
-# shell: chmod +x /usr/sbin/rabbitmqadmin
-# notify: restart rabbitmq-server
-# become: true
-# when: not rabbitmqadmin_check['stat']['exists']
-
- name: rabbitmq_ha_config | creating queue(s)
command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }}
run_once: true