systemd-resolved: use a drop-in for kubespray dns (#10732)
This avoid needlessly overriding things and make cleanup easier. Also simplifies the template a bit.
This commit is contained in:
@ -1,8 +1,14 @@
|
|||||||
---
|
---
|
||||||
- name: Write resolved.conf
|
- name: Create systemd-resolved drop-in directory
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
name: /etc/systemd/resolved.conf.d/
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Write Kubespray DNS settings to systemd-resolved
|
||||||
template:
|
template:
|
||||||
src: resolved.conf.j2
|
src: resolved.conf.j2
|
||||||
dest: /etc/systemd/resolved.conf
|
dest: /etc/systemd/resolved.conf.d/kubespray.conf
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
@ -1,21 +1,15 @@
|
|||||||
[Resolve]
|
[Resolve]
|
||||||
{% if dns_early is sameas true and dns_late is sameas false %}
|
{% if not dns_early and dns_late %}
|
||||||
#DNS=
|
|
||||||
{% else %}
|
|
||||||
DNS={{ ([nodelocaldns_ip] if enable_nodelocaldns else coredns_server )| list | join(' ') }}
|
DNS={{ ([nodelocaldns_ip] if enable_nodelocaldns else coredns_server )| list | join(' ') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
FallbackDNS={{ ( upstream_dns_servers|d([]) + nameservers|d([]) + cloud_resolver|d([])) | unique | join(' ') }}
|
FallbackDNS={{ ( upstream_dns_servers|d([]) + nameservers|d([]) + cloud_resolver|d([])) | unique | join(' ') }}
|
||||||
{% if remove_default_searchdomains is sameas true and searchdomains|default([])|length != 0 %}
|
{% if remove_default_searchdomains and searchdomains|default([])|length != 0 %}
|
||||||
Domains={{ searchdomains|default([]) | join(' ') }}
|
Domains={{ searchdomains|default([]) | join(' ') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
Domains={{ ([ 'default.svc.' + dns_domain, 'svc.' + dns_domain ] + searchdomains|default([])) | join(' ') }}
|
Domains={{ ([ 'default.svc.' + dns_domain, 'svc.' + dns_domain ] + searchdomains|default([])) | join(' ') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
#LLMNR=no
|
|
||||||
#MulticastDNS=no
|
|
||||||
DNSSEC=no
|
DNSSEC=no
|
||||||
Cache=no-negative
|
Cache=no-negative
|
||||||
{% if systemd_resolved_disable_stub_listener | bool %}
|
{% if systemd_resolved_disable_stub_listener | bool %}
|
||||||
DNSStubListener=no
|
DNSStubListener=no
|
||||||
{% else %}
|
|
||||||
#DNSStubListener=yes
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -314,6 +314,7 @@
|
|||||||
- /etc/dnsmasq.d
|
- /etc/dnsmasq.d
|
||||||
- /etc/dnsmasq.conf
|
- /etc/dnsmasq.conf
|
||||||
- /etc/dnsmasq.d-available
|
- /etc/dnsmasq.d-available
|
||||||
|
- /etc/systemd/resolved.conf.d/kubespray.conf
|
||||||
- /etc/etcd.env
|
- /etc/etcd.env
|
||||||
- /etc/calico
|
- /etc/calico
|
||||||
- /etc/NetworkManager/conf.d/calico.conf
|
- /etc/NetworkManager/conf.d/calico.conf
|
||||||
|
Reference in New Issue
Block a user