Skip to content

Commit

Permalink
Do not add /etc/hosts entry for 127.0.1.1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jonathan Rosser committed Jul 14, 2019
1 parent 7a33928 commit a71523f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
9 changes: 0 additions & 9 deletions templates/openstack-host-hostfile-setup.sh.j2
Expand Up @@ -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) }}" \
Expand Down
1 change: 0 additions & 1 deletion tests/test.yml
Expand Up @@ -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"
Expand Down

0 comments on commit a71523f

Please sign in to comment.