From e6b3ddbc1e8f1c558f4dcb615f5d5d3a96348584 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 21 Feb 2022 14:58:33 +0100 Subject: [PATCH] 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 --- tasks/rabbitmq_pre_install.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks/rabbitmq_pre_install.yml b/tasks/rabbitmq_pre_install.yml index 22e40829..4116ef00 100644 --- a/tasks/rabbitmq_pre_install.yml +++ b/tasks/rabbitmq_pre_install.yml @@ -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: