Remove affecting rabbitmq hosts record

Record for 127.0.1.1 is added by some distributions which makes
clustering fail, as Erlang port is binded to mgmt IP, while rabbit
expects to access it through $hostname, which would lead to 127.0.1.1.
At same time it's possbile to explicitly bind distribution port only
to single address. So we need to
ensure that hostname resolvs to mgmt IP and drop record for 127.0.1.1

Closes-Bug: #1960587
Change-Id: I907d4714319ac7134ede0dc62b51c1964b9befc5
This commit is contained in:
Dmitriy Rabotyagov 2022-02-21 14:58:33 +01:00
parent c8ce051651
commit e6b3ddbc1e
1 changed files with 5 additions and 0 deletions

View File

@ -49,6 +49,11 @@
state: present
line: '127.0.0.1 localhost'
regexp: '^127\.0\.0\.1'
- name: Remove hostname record for 127.0.1.1
replace:
path: /etc/hosts
regexp: '^(127\.0\.1\.1)\s*(\S*)\s*({{ ansible_facts["hostname"] }})($|\s.*)'
replace: '\1 \2 \4'
when:
- rabbitmq_manage_hosts_entries | bool
tags: