diff options
author | Gaëtan Duchaussois <gaetan.duchaussois@fretlink.com> | 2018-12-18 11:36:00 +0100 |
---|---|---|
committer | Gaëtan Duchaussois <gaetan.duchaussois@fretlink.com> | 2018-12-18 11:36:00 +0100 |
commit | c3b85a38ba6ce9465ee67c571916c5be11f683f0 (patch) | |
tree | 5bb38ff6dd0ac6cc1f5d363c48365f30d26fcf1c /tasks | |
parent | 991fe83812bb2814096e8ec3e8f6dc86fee5f3ef (diff) | |
download | ansible-rabbitmq-c3b85a38ba6ce9465ee67c571916c5be11f683f0.tar.gz ansible-rabbitmq-c3b85a38ba6ce9465ee67c571916c5be11f683f0.tar.zst ansible-rabbitmq-c3b85a38ba6ce9465ee67c571916c5be11f683f0.zip |
Allow multiple policies creation
Diffstat (limited to 'tasks')
-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 bf74957..e62fc83 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 }} | 24 | command: rabbitmqadmin declare queue name={{ item['queue_name'] }} durable={{ item['durable']|lower }} |
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) |