Configure /etc/hosts as expected by Debian.

cf. https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution
This commit is contained in:
Julien Palard 2022-09-30 14:07:07 +02:00
parent 861af29c7d
commit 47452f07f2
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8

View File

@ -5,11 +5,20 @@
hostname:
name: "{{ inventory_hostname_short }}"
- name: Configure FQDN
- name: Configure localhots
lineinfile:
path: /etc/hosts
regexp: '^127\.0\.0\.1'
line: "127.0.0.1 {{ inventory_hostname }} {{ inventory_hostname_short }} localhost"
line: "127.0.0.1 localhost"
owner: root
group: root
mode: 0644
- name: Configure FQDN
lineinfile:
path: /etc/hosts
regexp: '^127\.0\.1\.1'
line: "127.0.1.1 {{ inventory_hostname }} {{ inventory_hostname_short }}"
owner: root
group: root
mode: 0644