diff options
Diffstat (limited to 'tasks/rabbitmq_ha_config.yml')
-rw-r--r-- | tasks/rabbitmq_ha_config.yml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tasks/rabbitmq_ha_config.yml b/tasks/rabbitmq_ha_config.yml index c048aed..3cbc382 100644 --- a/tasks/rabbitmq_ha_config.yml +++ b/tasks/rabbitmq_ha_config.yml | |||
@@ -1,13 +1,21 @@ | |||
1 | --- | 1 | --- |
2 | - name: rabbitmq_ha_config | checking if rabbitmqadmin is installed | ||
3 | stat: | ||
4 | path: /usr/sbin/rabbitmqadmin | ||
5 | register: rabbitmqadmin_check | ||
6 | |||
2 | - name: rabbitmq_ha_config | install rabbitMQ admin | 7 | - name: rabbitmq_ha_config | install rabbitMQ admin |
3 | shell: wget http://guest:guest@localhost:55672/cli/rabbitmqadmin | 8 | shell: wget http://guest:guest@localhost:15672/cli/rabbitmqadmin |
9 | when: not rabbitmqadmin_check.stat.exists | ||
4 | 10 | ||
5 | - name: rabbitmq_ha_config | moving the rabbitMQ Admin | 11 | - name: rabbitmq_ha_config | moving the rabbitMQ Admin |
6 | shell: mv rabbitmqadmin /usr/sbin | 12 | shell: mv rabbitmqadmin /usr/sbin |
13 | when: not rabbitmqadmin_check.stat.exists | ||
7 | 14 | ||
8 | - name: rabbitmq_ha_config | making executable rabbitMQ Admin | 15 | - name: rabbitmq_ha_config | making executable rabbitMQ Admin |
9 | shell: chmod +x /usr/sbin/rabbitmqadmin | 16 | shell: chmod +x /usr/sbin/rabbitmqadmin |
10 | notify: restart rabbitmq-server | 17 | notify: restart rabbitmq-server |
18 | when: not rabbitmqadmin_check.stat.exists | ||
11 | 19 | ||
12 | - name: rabbitmq_ha_config | creating queue(s) | 20 | - name: rabbitmq_ha_config | creating queue(s) |
13 | command: rabbitmqadmin declare queue name={{ item.queue_name }} durable={{ item.durable|lower }} | 21 | command: rabbitmqadmin declare queue name={{ item.queue_name }} durable={{ item.durable|lower }} |
@@ -15,7 +23,11 @@ | |||
15 | with_items: rabbitmq_config | 23 | with_items: rabbitmq_config |
16 | 24 | ||
17 | - name: rabbitmq_ha_config | setting up ha on queue(s) | 25 | - name: rabbitmq_ha_config | setting up ha on queue(s) |
18 | rabbitmq_policy: name='ha-all' pattern='{{ item.queue_name }}' tags="{{ item.tags }}" state=present | 26 | rabbitmq_policy: |
27 | name: "ha-all" | ||
28 | pattern: "{{ item.queue_name }}" | ||
29 | tags: "{{ item.tags }}" | ||
30 | state: present | ||
19 | run_once: true | 31 | run_once: true |
20 | with_items: rabbitmq_config | 32 | with_items: rabbitmq_config |
21 | 33 | ||
@@ -23,8 +35,10 @@ | |||
23 | command: rabbitmqadmin declare exchange name={{ item.exchange_name }} type={{ item.type }} | 35 | command: rabbitmqadmin declare exchange name={{ item.exchange_name }} type={{ item.type }} |
24 | run_once: true | 36 | run_once: true |
25 | with_items: rabbitmq_config | 37 | with_items: rabbitmq_config |
38 | when: item.exchange_name is defined | ||
26 | 39 | ||
27 | - name: rabbitmq_ha_config | creating binding(s) | 40 | - name: rabbitmq_ha_config | creating binding(s) |
28 | command: rabbitmqadmin declare binding source={{ item.exchange_name }} destination_type="queue" destination={{ item.queue_name }} routing_key={{ item.routing_key }} | 41 | command: rabbitmqadmin declare binding source={{ item.exchange_name }} destination_type="queue" destination={{ item.queue_name }} routing_key={{ item.routing_key }} |
29 | run_once: true | 42 | run_once: true |
30 | with_items: rabbitmq_config | 43 | with_items: rabbitmq_config |
44 | when: item.exchange_name is defined | ||