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: