Merge "re-add rabbitmq config for clustering interface"
This commit is contained in:
commit
60f8b7410d
@ -79,6 +79,24 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart rabbitmq container
|
- Restart rabbitmq container
|
||||||
|
|
||||||
|
- name: Copying over advanced.config
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
service: "{{ rabbitmq_services['rabbitmq'] }}"
|
||||||
|
template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "{{ node_config_directory }}/{{ project_name }}/advanced.config"
|
||||||
|
mode: "0660"
|
||||||
|
with_first_found:
|
||||||
|
- "{{ node_custom_config }}/rabbitmq/{{ inventory_hostname }}/advanced.config"
|
||||||
|
- "{{ node_custom_config }}/rabbitmq/advanced.config"
|
||||||
|
- "advanced.config.j2"
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups[service.group]
|
||||||
|
- service.enabled | bool
|
||||||
|
notify:
|
||||||
|
- Restart rabbitmq container
|
||||||
|
|
||||||
- name: Copying over definitions.json
|
- name: Copying over definitions.json
|
||||||
become: true
|
become: true
|
||||||
vars:
|
vars:
|
||||||
|
7
ansible/roles/rabbitmq/templates/advanced.config.j2
Normal file
7
ansible/roles/rabbitmq/templates/advanced.config.j2
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[
|
||||||
|
{kernel, [
|
||||||
|
{inet_dist_use_interface, {% raw %}{{% endraw %}{{ api_interface_address | put_address_in_context('rabbitmq') }}}},
|
||||||
|
{inet_dist_listen_min, {{ role_rabbitmq_cluster_port }}},
|
||||||
|
{inet_dist_listen_max, {{ role_rabbitmq_cluster_port }}}
|
||||||
|
]}
|
||||||
|
].
|
@ -19,6 +19,12 @@
|
|||||||
"owner": "rabbitmq",
|
"owner": "rabbitmq",
|
||||||
"perm": "0600"
|
"perm": "0600"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"source": "{{ container_config_directory }}/advanced.config",
|
||||||
|
"dest": "/etc/rabbitmq/advanced.config",
|
||||||
|
"owner": "rabbitmq",
|
||||||
|
"perm": "0600"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"source": "{{ container_config_directory }}/definitions.json",
|
"source": "{{ container_config_directory }}/definitions.json",
|
||||||
"dest": "/etc/rabbitmq/definitions.json",
|
"dest": "/etc/rabbitmq/definitions.json",
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from ipaddress import ip_address
|
||||||
from kolla_ansible.exception import FilterError
|
from kolla_ansible.exception import FilterError
|
||||||
|
|
||||||
|
|
||||||
@ -27,18 +28,32 @@ def put_address_in_context(address, context):
|
|||||||
:returns: string with address in proper context
|
:returns: string with address in proper context
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if context not in ['url', 'memcache']:
|
if context not in ['url', 'memcache', 'rabbitmq']:
|
||||||
raise FilterError("Unknown context '{context}'"
|
raise FilterError("Unknown context '{context}'"
|
||||||
.format(context=context))
|
.format(context=context))
|
||||||
|
|
||||||
if ':' not in address:
|
if ':' not in address and context != 'rabbitmq':
|
||||||
return address
|
return address
|
||||||
|
|
||||||
# must be IPv6 raw address
|
# must be IPv6 raw address
|
||||||
|
|
||||||
if context == 'url':
|
if context == 'url':
|
||||||
return '[{address}]'.format(address=address)
|
return '[{address}]'.format(address=address)
|
||||||
elif context == 'memcache':
|
if context == 'memcache':
|
||||||
return 'inet6:[{address}]'.format(address=address)
|
return 'inet6:[{address}]'.format(address=address)
|
||||||
|
|
||||||
|
# rabbitmq/erlang has special syntax for ip addresses in IPv4 and IPv6
|
||||||
|
# see: https://www.erlang.org/doc/man/inet.html
|
||||||
|
# replacing dots and colons with decimal points
|
||||||
|
# and converting IPv6 as described here:
|
||||||
|
# https://www.erlang.org/doc/man/inet.html#type-ip6_address
|
||||||
|
|
||||||
|
if context == 'rabbitmq':
|
||||||
|
if ip_address(address).version == 6:
|
||||||
|
return (",".join(['16#%x' % int(x, 16)
|
||||||
|
for x in
|
||||||
|
ip_address(address).exploded.split(':')]))
|
||||||
|
|
||||||
|
return address.replace('.', ',')
|
||||||
|
|
||||||
return address
|
return address
|
||||||
|
@ -51,6 +51,15 @@ class TestAddressContextFilter(unittest.TestCase):
|
|||||||
self.assertEqual(put_address_in_context(addr, context),
|
self.assertEqual(put_address_in_context(addr, context),
|
||||||
'inet6:[{}]'.format(addr))
|
'inet6:[{}]'.format(addr))
|
||||||
|
|
||||||
|
def test_rabbitmq_context(self):
|
||||||
|
context = 'rabbitmq'
|
||||||
|
addr = '192.168.1.1'
|
||||||
|
self.assertEqual(put_address_in_context(addr, context),
|
||||||
|
'192,168,1,1')
|
||||||
|
addr = 'fd::'
|
||||||
|
self.assertEqual(put_address_in_context(addr, context),
|
||||||
|
'16#fd,16#0,16#0,16#0,16#0,16#0,16#0,16#0')
|
||||||
|
|
||||||
def test_unknown_context(self):
|
def test_unknown_context(self):
|
||||||
self.assertRaises(FilterError, put_address_in_context, '', 'lol')
|
self.assertRaises(FilterError, put_address_in_context, '', 'lol')
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
adds back the option to configure the rabbitmq
|
||||||
|
clustering interface via kolla
|
||||||
|
`LP#1900160 <https://bugs.launchpad.net/kolla-ansible/+bug/1900160>`
|
Loading…
Reference in New Issue
Block a user