diff options
Diffstat (limited to 'tasks/rabbitmq_ha_config.yml')
-rw-r--r-- | tasks/rabbitmq_ha_config.yml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tasks/rabbitmq_ha_config.yml b/tasks/rabbitmq_ha_config.yml index ffda6e9..9ebe297 100644 --- a/tasks/rabbitmq_ha_config.yml +++ b/tasks/rabbitmq_ha_config.yml | |||
@@ -24,16 +24,23 @@ | |||
24 | command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }} | 24 | command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} --vhost={{ item['vhost'] | default('/') }} |
25 | run_once: true | 25 | run_once: true |
26 | become: true | 26 | become: true |
27 | when: | ||
28 | - item['queue_name'] is defined | ||
27 | with_items: "{{ rabbitmq_config }}" | 29 | with_items: "{{ rabbitmq_config }}" |
28 | 30 | ||
29 | - name: rabbitmq_ha_config | setting up ha on queue(s) | 31 | - name: rabbitmq_ha_config | setting up ha on queue(s) |
30 | rabbitmq_policy: | 32 | rabbitmq_policy: |
31 | name: "ha-all" | 33 | name: "ha-all{{ policy_name }}" |
32 | pattern: "{{ item['queue_name'] }}" | 34 | pattern: "{{ item.queue_name | default(item.policy_pattern) }}" |
33 | tags: "{{ item['tags'] }}" | 35 | vhost: "{{ item.vhost | default('/') }}" |
36 | tags: "{{ item.tags }}" | ||
34 | state: present | 37 | state: present |
38 | vars: | ||
39 | policy_vhost: "{{ item.vhost | default('/') }}" | ||
40 | policy_name: "{{ item.policy_pattern is defined | ternary(policy_vhost + item.policy_pattern|default(''),item.queue_name|default('')) }}" | ||
35 | run_once: true | 41 | run_once: true |
36 | become: true | 42 | become: true |
43 | when: item.queue_name is defined or item.policy_pattern is defined | ||
37 | with_items: "{{ rabbitmq_config }}" | 44 | with_items: "{{ rabbitmq_config }}" |
38 | 45 | ||
39 | - name: rabbitmq_ha_config | creating exchange(s) | 46 | - name: rabbitmq_ha_config | creating exchange(s) |