ansible-ops-management/tasks/rabbitmq/topics.yml
2023-07-22 21:25:14 -07:00

32 lines
1 KiB
YAML

---
- name: Add topic exchanges
run_once: true
delegate_to: "{{ rabbitmq_cluster_list[0] }}"
community.rabbitmq.rabbitmq_exchange:
name: "{{ item.0.name }}"
exchange_type: "{{ item.0.exchange_type }}"
vhost: "{{ item.1.vhost }}"
login_user: "{{ rabbitmq_admin }}"
login_password: "{{ rabbitmq_admin_password }}"
loop: "{{ rabbitmq_topics | subelements('vhosts', 'skip_missing=True') }}"
when: rabbitmq_admin_password is defined
tags:
- rabbitmq_cluster
- name: Forward topics if configured
run_once: true
delegate_to: "{{ rabbitmq_cluster_list[0] }}"
community.rabbitmq.rabbitmq_binding:
destination_type: "{{ item.1.destination_type }}"
name: "{{ item.0.name }}"
dest: "{{ item.1.destination}}"
routing_key: "{{ item.1.routing_key }}"
vhost: "{{ item.1.vhost }}"
login_user: "{{ rabbitmq_admin }}"
login_password: "{{ rabbitmq_admin_password }}"
when:
- rabbitmq_admin_password is defined
- item.1.binding|bool
tags:
- rabbitmq_cluster
...