From 3ebc4d1520ba8805629992ca3e5f7e292ac5ba2e Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 23 Jul 2026 01:14:37 +0200 Subject: [PATCH] fix(sys-hostname): guarantee *.localhost loopback resolution on every target The guide matrix rolled debian, whose image ships neither libnss_myhostname nor a myhostname nsswitch entry, so *.infinito.localhost fell through to DNS, coredns only knows the outer stack's domain, and hlth-webserver died on NXDOMAIN; arch passed because its base enables nss-myhostname out of the box. Install libnss-myhostname on the Debian family and append myhostname to the nsswitch hosts line idempotently, also inside containers - mirroring the host-mode guide fix. Probed across all five CI distros: fedora/centos/arch already resolve out of the box (both tasks no-op), debian/ubuntu gain exactly the missing pieces. Co-Authored-By: Claude Opus 4.8 (1M context) --- roles/sys-hostname/tasks/01_core.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/roles/sys-hostname/tasks/01_core.yml b/roles/sys-hostname/tasks/01_core.yml index 797d791e1c..60e9437856 100644 --- a/roles/sys-hostname/tasks/01_core.yml +++ b/roles/sys-hostname/tasks/01_core.yml @@ -23,4 +23,19 @@ create: true when: not DOCKER_IN_CONTAINER | bool +- name: ✅ Ensure nss-myhostname is installed so *.localhost resolves to loopback + become: true + ansible.builtin.package: + name: libnss-myhostname + state: present + when: ansible_facts.os_family == 'Debian' + +- name: ✅ Ensure nsswitch resolves hosts via myhostname + become: true + ansible.builtin.lineinfile: + path: /etc/nsswitch.conf + regexp: "^(hosts:(?!.*\\bmyhostname\\b).*)$" + line: "\\1 myhostname" + backrefs: true + - include_tasks: utils/once/flag.yml