kubernetes: k3s resolv-conf from fixed nameservers 1.1.1.1 and 9.9.9.9 instead of a copy of the node

This commit is contained in:
2026-10-27 15:24:48 +00:00
parent e1b5639d65
commit 66657f3917
3 changed files with 19 additions and 11 deletions
+7 -9
View File
@@ -45,17 +45,15 @@
else (ansible_default_ipv6.address | default('')) }}
- block:
- name: Read resolv.conf
shell: "grep '^nameserver' /etc/resolv.conf"
register: nameserver_line
changed_when: false
check_mode: false
- name: Write /etc/resolv-k3s.conf with only nameservers
copy:
content: "{{ nameserver_line.stdout }}"
- name: Write /etc/resolv-k3s.conf with the fixed nameservers
template:
src: resolv-k3s.conf.jinja2
dest: /etc/resolv-k3s.conf
owner: root
group: root
mode: "0644"
when: kubernetes.network.clean_resolv_conf is true
tags: resolv_conf
- name: Run handlers to reload configurations
meta: flush_handlers