From a71523f7c361e2a2406cec38d572be23e826f664 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Sat, 13 Jul 2019 21:34:45 +0100 Subject: [PATCH] Do not add /etc/hosts entry for 127.0.1.1 This patch removes a task which adds an entry to /etc/hosts for the hostname / 127.0.1.1. Some services, such as rabbitmq, require that the ip address they are configured to listen on resolves to a hostname with the same ip. Before this patch there were two /etc/hosts entries for the hostname of each host, 127.0.1.1 and the mgmt network address. This patch ensures that the /etc/hosts file is unambiguous and always resolves the hostname to the mgmt network ip address. Change-Id: I5c9bf4cd0a3a416447f6f1797df4657402a64382 --- templates/openstack-host-hostfile-setup.sh.j2 | 9 --------- tests/test.yml | 1 - 2 files changed, 10 deletions(-) diff --git a/templates/openstack-host-hostfile-setup.sh.j2 b/templates/openstack-host-hostfile-setup.sh.j2 index b3555b43..3c48cf9b 100644 --- a/templates/openstack-host-hostfile-setup.sh.j2 +++ b/templates/openstack-host-hostfile-setup.sh.j2 @@ -34,15 +34,6 @@ function host_update { fi } -{% raw -%} -{% set host_rfc_1034_1035_name = inventory_hostname|replace('_', '-') %} -host_update "{{ ansible_hostname|default(host_rfc_1034_1035_name) }}" \ - "{{ host_rfc_1034_1035_name }}" \ - "{{ inventory_hostname }}" \ - "127.0.1.1" \ - "{{ openstack_domain }}" -{% endraw %} - {% for item in groups['all'] %} {% set target_rfc_1034_1035_name = item|replace('_', '-') %} host_update "{{ hostvars[item]['ansible_hostname']|default(target_rfc_1034_1035_name) }}" \ diff --git a/tests/test.yml b/tests/test.yml index aaf322d0..db3ca5da 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -136,7 +136,6 @@ - "'ebtables' in modules_content" - "'vm.swappiness' in sysctl_content" - "'127.0.0.1 {{ ansible_hostname }}.openstack.local localhost {{ ansible_hostname }}' in hosts_content" - - "'127.0.1.1 {{ ansible_hostname }}.openstack.local localhost {{ ansible_hostname }}' in hosts_content" - "'127.111.111.101 {{ ansible_hostname }}.openstack.local test1 {{ ansible_hostname }}' in hosts_content" - "'127.111.111.102 {{ ansible_hostname }}.openstack.local test2 {{ ansible_hostname }}' in hosts_content" - "'127.111.111.103 {{ ansible_hostname }}.openstack.local test3 {{ ansible_hostname }}' in hosts_content"