Do not add container /etc/hosts entry for 127.0.1.1

This patch removes a task which adds an entry to /etc/hosts for
the container 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 container, 127.0.1.1 and the container mgmt
network address.

This patch ensures that the /etc/hosts file is unambiguous and
always resolves the container hostname to the mgmt network ip
address.

Change-Id: I900bda8031d7b0798f73adf8985e64d4535be769
This commit is contained in:
Jonathan Rosser 2019-07-13 21:21:20 +01:00
parent 04cbc6a020
commit fe13e7729d

View File

@ -225,16 +225,6 @@
mode: "0644"
remote_user: root
- name: Create domain config
lineinfile:
dest: "/etc/hosts"
regexp: "^127.0.1.1"
line: "127.0.1.1 {{ inventory_hostname | replace('_', '-') }}.{{ lxc_container_domain }} {{ inventory_hostname | replace('_', '-') }}"
owner: "root"
group: "root"
mode: "0644"
remote_user: root
- name: Ensure the hostnamed override directory exists
file:
path: "/etc/systemd/system/systemd-hostnamed.service.d"