From 618eae997ea25a0d7a6a9b8547608c25efd70e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Thu, 4 Oct 2018 16:26:42 +0000 Subject: [PATCH] Create the RabbitMQ user, queues and bindings --- .../openshift-apps/messaging-bridges.yml | 56 +++++++++++++++++++ .../messaging-bridges/templates/configmap.yml | 4 +- roles/rabbitmq_cluster/tasks/main.yml | 2 +- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/playbooks/openshift-apps/messaging-bridges.yml b/playbooks/openshift-apps/messaging-bridges.yml index e4fe0962e7..519e03937a 100644 --- a/playbooks/openshift-apps/messaging-bridges.yml +++ b/playbooks/openshift-apps/messaging-bridges.yml @@ -1,3 +1,59 @@ +# Create the RabbitMQ users + +tasks: + hosts: rabbitmq-stg[0] + user: root + gather_facts: False + + tasks: + - name: Create the RabbitMQ user + rabbitmq_user: + user: messaging-bridges + vhost: /pubsub + read_priv: .* + write_priv: .* + tags: + - config + - name: Create the RabbitMQ exchanges + rabbitmq_exchange: + name: "{{item}}" + exchange_type: topic + vhost: /pubsub + with_items: + - amq.topic + - zmq.topic + tags: + - config + - name: Create the RabbitMQ queues + rabbitmq_queue: + name: "{{item}}" + vhost: /pubsub + with_items: + - amqp_to_zmq + - amqp_bridge_verify_missing + tags: + - config + - name: Create the amqp-to-zmq bindings + rabbitmq_binding: + source: amq.topic + destination: amqp_to_zmq + vhost: /pubsub + tags: + - config + - name: Create the verify-missing bindings + rabbitmq_binding: + source: "{{item}}" + destination: amqp_bridge_verify_missing + vhost: /pubsub + with_items: + - amq.topic + - zmq.topic + tags: + - config + + +# Now create the app + - name: make the app be real hosts: os-masters-stg[0] user: root diff --git a/roles/openshift-apps/messaging-bridges/templates/configmap.yml b/roles/openshift-apps/messaging-bridges/templates/configmap.yml index ba2e4d9a87..dc8b2e8186 100644 --- a/roles/openshift-apps/messaging-bridges/templates/configmap.yml +++ b/roles/openshift-apps/messaging-bridges/templates/configmap.yml @@ -7,7 +7,7 @@ metadata: app: messaging-bridges data: config.toml: |- - amqp_url = "amqps://rabbitmq01{{ env_suffix }}.phx2.fedoraproject.org" + amqp_url = "amqps://messaging-bridges@rabbitmq01{{ env_suffix }}.phx2.fedoraproject.org/pubsub" publish_exchange = "amq.topic" [tls] @@ -43,7 +43,7 @@ data: level = "WARNING" handlers = ["console"] amqp-to-zmq.toml: |- - amqp_url = "amqps://rabbitmq01{{ env_suffix }}.phx2.fedoraproject.org" + amqp_url = "amqps://messaging-bridges@rabbitmq01{{ env_suffix }}.phx2.fedoraproject.org/pubsub" publish_exchange = "amq.topic" [[bindings]] diff --git a/roles/rabbitmq_cluster/tasks/main.yml b/roles/rabbitmq_cluster/tasks/main.yml index 1781eb2c48..7a3936f796 100644 --- a/roles/rabbitmq_cluster/tasks/main.yml +++ b/roles/rabbitmq_cluster/tasks/main.yml @@ -99,7 +99,7 @@ tags: - rabbitmq_cluster -- name: Nope. No standard users. Even if we user TLS auth +- name: Nope. No standard users. Even if we use TLS auth rabbitmq_user: user=guest state=absent tags: - rabbitmq_cluster