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