aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorPaul Bonaud <paul.bonaud@fretlink.com>2018-12-20 11:03:39 +0100
committerPaul Bonaud <paul.bonaud@fretlink.com>2018-12-20 11:25:37 +0100
commitfa6c482bae5ea36e52b575281feeab2649a8321f (patch)
tree9989385300c3a01eaae39ffcae38752cbab69230 /tasks
parentd58696271f166b50faa2705fdda6337c1ffb493c (diff)
downloadansible-rabbitmq-fa6c482bae5ea36e52b575281feeab2649a8321f.tar.gz
ansible-rabbitmq-fa6c482bae5ea36e52b575281feeab2649a8321f.tar.zst
ansible-rabbitmq-fa6c482bae5ea36e52b575281feeab2649a8321f.zip
clustering: make sure to delegate admin tasks to the master node
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 98e45e2..083c704 100644
--- a/tasks/rabbitmq_users.yml
+++ b/tasks/rabbitmq_users.yml
@@ -27,6 +27,7 @@
27 tags: "{{ item['tags'] }}" 27 tags: "{{ item['tags'] }}"
28 state: present 28 state: present
29 run_once: yes 29 run_once: yes
30 delegate_to: "{{ rabbitmq_master }}"
30 become: true 31 become: true
31 with_items: "{{ rabbitmq_users }}" 32 with_items: "{{ rabbitmq_users }}"
32 when: > 33 when: >