add rabbitmq topics
This commit is contained in:
parent
8d458ed5bb
commit
ff5cb35875
32
tasks/rabbitmq/topics.yml
Normal file
32
tasks/rabbitmq/topics.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
- 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
|
||||
...
|
@ -3,6 +3,7 @@
|
||||
community.rabbitmq.rabbitmq_user:
|
||||
user: "{{ item.user }}"
|
||||
state: absent
|
||||
loop: "{{ rabbitmq_users }}"
|
||||
when: item.state == 'absent'
|
||||
|
||||
- name: Add and configure single vhost users
|
||||
|
@ -9,6 +9,7 @@ rabbitmq_tls_key: "/etc/pki/tls/private/{{ ansible_fqdn }}.key"
|
||||
# rabbitmq_cookie: ...
|
||||
|
||||
# Admin passwords - these should be in a vault
|
||||
rabbitmq_admin: "rockyadmin"
|
||||
# rabbitmq_admin_password: ...
|
||||
|
||||
# rabbitmq cluster list and information should be defined in hostvars to ensure
|
||||
|
@ -1,4 +1,13 @@
|
||||
---
|
||||
rabbitmq_topics:
|
||||
-
|
||||
- name: "zmq.topic"
|
||||
exchange_type: "topic"
|
||||
vhosts:
|
||||
- vhost: "public_pubsub"
|
||||
destination: "amq.topic"
|
||||
destination_type: "exchange"
|
||||
routing_key: "#"
|
||||
binding: true
|
||||
- vhost: "pubsub"
|
||||
binding: false
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user