blob: 0048b0c5191c11ccd72fe681fc7479077d682c17 (
plain) (
tree)
|
|
---
- name: rabbitmq_ha_config | checking if rabbitmqadmin is installed
stat:
path: /usr/sbin/rabbitmqadmin
register: rabbitmqadmin_check
- name: rabbit_ha_config | Installing rabbitMQ admin
get_url:
url: http://guest:guest@localhost:15672/cli/rabbitmqadmin
dest: /usr/sbin/rabbitmqadmin
mode: u=rwx,g=rw,o=rw
become: true
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
become: 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
become: 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
become: 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
become: true
with_items: "{{ rabbitmq_config }}"
when: item['exchange_name'] is defined
|