From 87c7661268b0ea7bfe511ae7edb9ef6730484c2a Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 25 Dec 2023 13:14:51 +0200 Subject: feat: installer uses systemd-resolved Signed-off-by: Lars Wirzenius Sponsored-by: author fix: domain-less DNS lookups Signed-off-by: Lars Wirzenius Sponsored-by: author --- installer-ansible.yml | 10 ++++++++++ installer.vmdb | 1 + 2 files changed, 11 insertions(+) diff --git a/installer-ansible.yml b/installer-ansible.yml index e924f06..2b2914e 100644 --- a/installer-ansible.yml +++ b/installer-ansible.yml @@ -152,8 +152,18 @@ [DHCPv4] RouteMetric=20 + UseDomains=true dest: /etc/systemd/network/eth0.network + # Allow lookup of domain-less names, when the DHCP server doesn't + # set a domain for the LAN. See + # https://wiki.archlinux.org/title/Systemd-resolved#systemd-resolved_does_not_resolve_hostnames_without_suffix + - name: "tweak resolved.conf for domain-less DNS lookup" + lineinfile: + path: /etc/systemd/resolved.conf + regexp: ResolveUnicastSingleLabel= + line: ResolveUnicastSingleLabel=yes + - name: "configure bridge device br0 for local network ports" copy: content: | diff --git a/installer.vmdb b/installer.vmdb index da12124..0819a75 100644 --- a/installer.vmdb +++ b/installer.vmdb @@ -58,6 +58,7 @@ steps: - dosfstools - rsync - btrfs-progs + - systemd-resolved tag: root - ansible: root -- cgit v1.2.1 From fc25990b231623c3aff7f6e1323e45bed4f9a958 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 25 Dec 2023 15:25:55 +0200 Subject: TEMP FIX: create resolv.conf in vmdb2 chroot The chroot has no /etc/resolv.conf when Ansible runs, for reasons I don't understand yet, and thus Ansible can't install new packages. Signed-off-by: Lars Wirzenius Sponsored-by: author --- installer-ansible.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/installer-ansible.yml b/installer-ansible.yml index 2b2914e..f6bfe6e 100644 --- a/installer-ansible.yml +++ b/installer-ansible.yml @@ -3,6 +3,19 @@ - hosts: image tasks: + # This is a workaround for the fact the the chroot vmdb2 creates + # lacks an /etc/resolv.conf. + - name: "install a temporary /etc/resolv.conf" + copy: + content: + nameserver 8.8.8.8 + dest: /etc/resolv.conf + + - name: "check /etc/resolv.conf and DNS lookup work" + shell: | + cat /etc/resolv.conf || true + ping -c1 pieni.net + # General configuration of installer system. - name: "install file with version info of installer" -- cgit v1.2.1 From 1c67b1c2fd6168b56955536ee679f50f161f4998 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 26 Dec 2023 08:22:41 +0200 Subject: feat: installed system uses systemd-resolved for DNS Signed-off-by: Lars Wirzenius Sponsored-by: author --- std.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/std.yml b/std.yml index a69b6bb..14f516c 100644 --- a/std.yml +++ b/std.yml @@ -176,6 +176,26 @@ name: systemd-networkd enabled: yes + - name: "install resolved" + apt: + name: + - systemd-resolved + + - name: "enable resolved" + systemd: + name: systemd-resolved + enabled: yes + + # Allow lookup of domain-less names, when the DHCP server doesn't + # set a domain for the LAN. See + # https://wiki.archlinux.org/title/Systemd-resolved#systemd-resolved_does_not_resolve_hostnames_without_suffix + - name: "tweak resolved.conf for domain-less DNS lookup" + lineinfile: + path: /etc/systemd/resolved.conf + regexp: ResolveUnicastSingleLabel= + line: ResolveUnicastSingleLabel=yes + + vars: ansible_python_interpreter: /usr/bin/python3 -- cgit v1.2.1