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
This commit is contained in:
Jonathan Rosser 2019-07-13 21:34:45 +01:00
parent 7a339288b4
commit a71523f7c3
2 changed files with 0 additions and 10 deletions

View File

@ -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) }}" \

View File

@ -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"