From 109c6b750751d1c5cd216ad2f09258cf512c4c9e Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Sat, 3 Dec 2016 17:51:25 -0500 Subject: Addressed issue #6 Signed-off-by: Larry Smith Jr --- .../ansible-rabbitmq/tasks/rabbitmq_ha_config.yml | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml (limited to 'Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml') diff --git a/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml b/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml new file mode 100644 index 0000000..8811b6d --- /dev/null +++ b/Vagrant/roles/ansible-rabbitmq/tasks/rabbitmq_ha_config.yml @@ -0,0 +1,44 @@ +--- +- name: rabbitmq_ha_config | checking if rabbitmqadmin is installed + stat: + path: /usr/sbin/rabbitmqadmin + register: rabbitmqadmin_check + +- name: rabbitmq_ha_config | install rabbitMQ admin + shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin + when: not rabbitmqadmin_check.stat.exists + +- name: rabbitmq_ha_config | moving the rabbitMQ Admin + shell: mv rabbitmqadmin /usr/sbin + when: not rabbitmqadmin_check.stat.exists + +- name: rabbitmq_ha_config | making executable rabbitMQ Admin + shell: chmod +x /usr/sbin/rabbitmqadmin + notify: restart rabbitmq-server + 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 }} + run_once: true + with_items: "{{ rabbitmq_config }}" + +- name: rabbitmq_ha_config | setting up ha on queue(s) + rabbitmq_policy: + name: "ha-all" + pattern: "{{ item.queue_name }}" + tags: "{{ item.tags }}" + state: present + run_once: true + with_items: "{{ rabbitmq_config }}" + +- name: rabbitmq_ha_config | creating exchange(s) + command: rabbitmqadmin declare exchange name={{ item.exchange_name }} type={{ item.type }} + run_once: true + with_items: "{{ rabbitmq_config }}" + when: item.exchange_name is defined + +- name: rabbitmq_ha_config | creating binding(s) + command: rabbitmqadmin declare binding source={{ item.exchange_name }} destination_type="queue" destination={{ item.queue_name }} routing_key={{ item.routing_key }} + run_once: true + with_items: "{{ rabbitmq_config }}" + when: item.exchange_name is defined -- cgit v1.2.3