diff --git a/ansible/roles/rabbitmq/tasks/config.yml b/ansible/roles/rabbitmq/tasks/config.yml index 740b3a230e..81d3eedb98 100644 --- a/ansible/roles/rabbitmq/tasks/config.yml +++ b/ansible/roles/rabbitmq/tasks/config.yml @@ -14,8 +14,10 @@ dest: "{{ node_config_directory }}/rabbitmq/rabbitmq-env.conf" } - { src: "rabbitmq.config.j2", dest: "{{ node_config_directory }}/rabbitmq/rabbitmq.config" } + - { src: "rabbitmq_clusterer.config.j2", + dest: "{{ node_config_directory }}/rabbitmq/rabbitmq_clusterer.config" } - name: Copying Rabbitmq JSON configuration file template: src: "roles/rabbitmq/templates/rabbitmq.json.j2" - dest: "{{ node_config_directory }}/rabbitmq/config.json" \ No newline at end of file + dest: "{{ node_config_directory }}/rabbitmq/config.json" diff --git a/ansible/roles/rabbitmq/tasks/main.yml b/ansible/roles/rabbitmq/tasks/main.yml index 8ef641d99d..98daa4021c 100644 --- a/ansible/roles/rabbitmq/tasks/main.yml +++ b/ansible/roles/rabbitmq/tasks/main.yml @@ -4,8 +4,3 @@ - include: bootstrap.yml - include: start.yml - -- name: Sleep while cluster starts - command: sleep 5 - changed_when: False - failed_when: False diff --git a/ansible/roles/rabbitmq/templates/rabbitmq-env.conf.j2 b/ansible/roles/rabbitmq/templates/rabbitmq-env.conf.j2 index 732a286a02..549b7f0c9b 100644 --- a/ansible/roles/rabbitmq/templates/rabbitmq-env.conf.j2 +++ b/ansible/roles/rabbitmq/templates/rabbitmq-env.conf.j2 @@ -1,7 +1,12 @@ RABBITMQ_NODENAME=rabbit +RABBITMQ_BOOT_MODULE=rabbit_clusterer -# See bug https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/1374109 {% if not kolla_base_distro in ['ubuntu', 'debian'] %} +RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.5/plugins/rabbitmq_clusterer-3.5.x-189b3a81.ez/rabbitmq_clusterer-3.5.x-189b3a81/ebin" +# See bug https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/1374109 export ERL_EPMD_ADDRESS={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} +{% else %} +RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.4/plugins/rabbitmq_clusterer-3.5.x-189b3a81.ez/rabbitmq_clusterer-3.5.x-189b3a81/ebin" {% endif %} + export ERL_EPMD_PORT={{ rabbitmq_epmd_port }} diff --git a/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 b/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 index 6aa3a5fb1c..213a32453d 100644 --- a/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 +++ b/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 @@ -10,17 +10,14 @@ ]}, {default_user, <<"{{ rabbitmq_user }}">>}, {default_pass, <<"{{ rabbitmq_password }}">>}, - {cluster_partition_handling, autoheal}, - {cluster_nodes, {[ - {% for host in groups['rabbitmq'] %}'rabbit@{{ hostvars[host]['ansible_hostname'] }}'{% if not loop.last %},{% endif %}{% endfor %} - - ], disc}} + {cluster_partition_handling, autoheal} ]}, {rabbitmq_management, [ {listener, [ {ip, "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"}, {port, {{ rabbitmq_management_port }}} ]} - ]} + ]}, + {rabbitmq_clusterer, [{config, "/etc/rabbitmq/rabbitmq_clusterer.config"}]} ]. % EOF diff --git a/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 b/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 index 264c96fde0..8eb38dc37e 100644 --- a/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 +++ b/ansible/roles/rabbitmq/templates/rabbitmq.json.j2 @@ -12,6 +12,12 @@ "dest": "/etc/rabbitmq/rabbitmq.config", "owner": "rabbitmq", "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/rabbitmq_clusterer.config", + "dest": "/etc/rabbitmq/rabbitmq_clusterer.config", + "owner": "rabbitmq", + "perm": "0600" } ] } diff --git a/ansible/roles/rabbitmq/templates/rabbitmq_clusterer.config.j2 b/ansible/roles/rabbitmq/templates/rabbitmq_clusterer.config.j2 new file mode 100644 index 0000000000..fe199394a0 --- /dev/null +++ b/ansible/roles/rabbitmq/templates/rabbitmq_clusterer.config.j2 @@ -0,0 +1,9 @@ +[ + {version, 1}, + {nodes, [ +{% for host in groups['rabbitmq'] %} {rabbit@{{ hostvars[host]['ansible_hostname'] }}, disc}{% if not loop.last %},{% endif %} + +{% endfor %} + ]}, + {gospel, {node, rabbit@{{ hostvars[groups['rabbitmq'][0]]['ansible_hostname'] }}}} +]. diff --git a/ansible/site.yml b/ansible/site.yml index f89884f23a..f205574efc 100755 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -16,7 +16,6 @@ - { role: mariadb, tags: mariadb, when: enable_mariadb | bool } - hosts: rabbitmq - serial: 1 roles: - { role: rabbitmq, tags: rabbitmq, when: enable_rabbitmq | bool }