From 2cf26261f48bbd3f172b8a529df25906822ff219 Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Wed, 19 Dec 2018 09:52:51 -0500 Subject: First commit of refactoring --- README.md | 76 ++++++++++++++++++++++++-------------------- defaults/main.yml | 12 +++---- handlers/main.yml | 2 +- tasks/debian.yml | 6 +++- tasks/main.yml | 3 +- tasks/rabbitmq_ha_config.yml | 16 ---------- 6 files changed, 56 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index b3b03ad..15f9cdf 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,73 @@ -Role Name -========= + + +**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 ------------- + + +# 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]: -[Ansible]: -[RabbitMQ]: +- [@mrlesmithjr](https://www.twitter.com/mrlesmithjr) +- [EverythingShouldBeVirtual](http://everythingshouldbevirtual.com) +- [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com) diff --git a/defaults/main.yml b/defaults/main.yml index a13fec0..4771a6b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,15 +15,15 @@ rabbitmq_config: [] 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 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 @@ # handlers file for ansible-rabbitmq - name: restart rabbitmq-server service: - name: "rabbitmq-server" + name: rabbitmq-server state: restarted 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 @@ 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 @@ -34,8 +36,10 @@ 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: 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 @@ 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 diff --git a/tasks/rabbitmq_ha_config.yml b/tasks/rabbitmq_ha_config.yml index cc31333..cea301c 100644 --- a/tasks/rabbitmq_ha_config.yml +++ b/tasks/rabbitmq_ha_config.yml @@ -13,22 +13,6 @@ 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 -- cgit v1.2.3