aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'tasks')
-rw-r--r--tasks/rabbitmq_ha_config.yml18
-rw-r--r--tasks/rabbitmq_users.yml1
2 files changed, 12 insertions, 7 deletions
diff --git a/tasks/rabbitmq_ha_config.yml b/tasks/rabbitmq_ha_config.yml
index cea301c..322172d 100644
--- a/tasks/rabbitmq_ha_config.yml
+++ b/tasks/rabbitmq_ha_config.yml
@@ -13,9 +13,18 @@
13 notify: restart rabbitmq-server 13 notify: restart rabbitmq-server
14 when: not rabbitmqadmin_check['stat']['exists'] 14 when: not rabbitmqadmin_check['stat']['exists']
15 15
16- name: rabbitmq_ha_config | creating exchange(s)
17 command: rabbitmqadmin declare exchange name={{ item['exchange_name'] }} type={{ item['type'] }} --vhost={{ item['vhost'] | default('/') }}
18 run_once: true
19 delegate_to: "{{ rabbitmq_master }}"
20 become: true
21 with_items: "{{ rabbitmq_config }}"
22 when: item['exchange_name'] is defined
23
16- name: rabbitmq_ha_config | creating queue(s) 24- name: rabbitmq_ha_config | creating queue(s)
17 command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }} 25 command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }}
18 run_once: true 26 run_once: true
27 delegate_to: "{{ rabbitmq_master }}"
19 become: true 28 become: true
20 when: 29 when:
21 - item['queue_name'] is defined 30 - item['queue_name'] is defined
@@ -32,20 +41,15 @@
32 policy_vhost: "{{ item.vhost | default('/') }}" 41 policy_vhost: "{{ item.vhost | default('/') }}"
33 policy_name: "{{ item.policy_pattern is defined | ternary(policy_vhost + item.policy_pattern|default(''),item.queue_name|default('')) }}" 42 policy_name: "{{ item.policy_pattern is defined | ternary(policy_vhost + item.policy_pattern|default(''),item.queue_name|default('')) }}"
34 run_once: true 43 run_once: true
44 delegate_to: "{{ rabbitmq_master }}"
35 become: true 45 become: true
36 when: item.queue_name is defined or item.policy_pattern is defined 46 when: item.queue_name is defined or item.policy_pattern is defined
37 with_items: "{{ rabbitmq_config }}" 47 with_items: "{{ rabbitmq_config }}"
38 48
39- name: rabbitmq_ha_config | creating exchange(s)
40 command: rabbitmqadmin declare exchange name={{ item['exchange_name'] }} type={{ item['type'] }} --vhost={{ item['vhost'] | default('/') }}
41 run_once: true
42 become: true
43 with_items: "{{ rabbitmq_config }}"
44 when: item['exchange_name'] is defined
45
46- name: rabbitmq_ha_config | creating binding(s) 49- name: rabbitmq_ha_config | creating binding(s)
47 command: rabbitmqadmin declare binding source={{ item['exchange_name'] }} destination_type="queue" destination={{ item['queue_name'] }} routing_key={{ item['routing_key'] }} --vhost={{ item['vhost'] | default('/') }} 50 command: rabbitmqadmin declare binding source={{ item['exchange_name'] }} destination_type="queue" destination={{ item['queue_name'] }} routing_key={{ item['routing_key'] }} --vhost={{ item['vhost'] | default('/') }}
48 run_once: true 51 run_once: true
52 delegate_to: "{{ rabbitmq_master }}"
49 become: true 53 become: true
50 with_items: "{{ rabbitmq_config }}" 54 with_items: "{{ rabbitmq_config }}"
51 when: item['exchange_name'] is defined 55 when: item['exchange_name'] is defined
diff --git a/tasks/rabbitmq_users.yml b/tasks/rabbitmq_users.yml
index 82aa734..7bba65e 100644
--- a/tasks/rabbitmq_users.yml
+++ b/tasks/rabbitmq_users.yml
@@ -29,6 +29,7 @@
29 permissions: "{{ item['permissions']|default(omit) }}" 29 permissions: "{{ item['permissions']|default(omit) }}"
30 state: present 30 state: present
31 run_once: yes 31 run_once: yes
32 delegate_to: "{{ rabbitmq_master }}"
32 become: true 33 become: true
33 with_items: "{{ rabbitmq_users }}" 34 with_items: "{{ rabbitmq_users }}"
34 when: > 35 when: >