diff --git a/ansible/roles/rabbitmq/tasks/config.yml b/ansible/roles/rabbitmq/tasks/config.yml index 28b29ea97c..e104fb8bc9 100644 --- a/ansible/roles/rabbitmq/tasks/config.yml +++ b/ansible/roles/rabbitmq/tasks/config.yml @@ -14,7 +14,7 @@ with_items: - "rabbitmq" -- name: Copying over rabbitmq*.conf +- name: Copying over rabbitmq configs template: src: "{{ item }}.j2" dest: "{{ node_config_directory }}/rabbitmq/{{ item }}" @@ -22,3 +22,4 @@ - "rabbitmq-env.conf" - "rabbitmq.config" - "rabbitmq-clusterer.config" + - "definitions.json" diff --git a/ansible/roles/rabbitmq/templates/definitions.json.j2 b/ansible/roles/rabbitmq/templates/definitions.json.j2 new file mode 100644 index 0000000000..fdb7267b51 --- /dev/null +++ b/ansible/roles/rabbitmq/templates/definitions.json.j2 @@ -0,0 +1,14 @@ +{ + "vhosts": [ + {"name": "/"} + ], + "users": [ + {"name": "{{ rabbitmq_user }}", "password": "{{ rabbitmq_password }}", "tags": "administrator"} + ], + "permissions": [ + {"user": "{{ rabbitmq_user }}", "vhost": "/", "configure": ".*", "write": ".*", "read": ".*"} + ], + "policies":[ + {"vhost": "/", "name": "ha-all", "pattern": ".*", "apply-to": "all", "definition": {"ha-mode":"all"}, "priority":0} + ] +} diff --git a/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 b/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 index 50c931ef4c..7db5f020d7 100644 --- a/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 +++ b/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 @@ -8,15 +8,14 @@ {tcp_listeners, [ {"{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}", {{ rabbitmq_port }}} ]}, - {default_user, <<"{{ rabbitmq_user }}">>}, - {default_pass, <<"{{ rabbitmq_password }}">>}, {cluster_partition_handling, autoheal} ]}, {rabbitmq_management, [ {listener, [ {ip, "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"}, {port, {{ rabbitmq_management_port }}} - ]} + ]}, + {load_definitions, "/etc/rabbitmq/definitions.json"} ]}, {rabbitmq_clusterer, [{config, "/etc/rabbitmq/rabbitmq-clusterer.config"}]} ]. diff --git a/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 b/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 index 9aef3c6911..4e99cc2183 100644 --- a/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 +++ b/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 @@ -18,6 +18,12 @@ "dest": "/etc/rabbitmq/rabbitmq-clusterer.config", "owner": "rabbitmq", "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/definitions.json", + "dest": "/etc/rabbitmq/definitions.json", + "owner": "rabbitmq", + "perm": "0600" } ] }