mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-05-21 15:58:14 -02:30
kubernetes/preinstall: dns setting cleanup(dhclient, resolvconf)
We use a lot of facts where variables are enough, and format too early, which prevent reusing the variables in different contexts. - Moves set_fact variables to the vars directory, remove unnecessary intermediate variables, and render them at usage sites to only do logic on native Ansible/Jinja lists. - Use defaults/ rather than default filters for several variables.
This commit is contained in:
@@ -4,11 +4,12 @@
|
||||
path: /etc/NetworkManager/conf.d/dns.conf
|
||||
section: global-dns-domain-*
|
||||
option: servers
|
||||
value: "{{ nameserverentries }}"
|
||||
value: "{{ nameserverentries | join(',') }}"
|
||||
mode: '0600'
|
||||
backup: true
|
||||
when:
|
||||
- nameserverentries != "127.0.0.53" or systemd_resolved_enabled.rc != 0
|
||||
- ('127.0.0.53' not in nameserverentries
|
||||
or systemd_resolved_enabled.rc != 0)
|
||||
notify: Preinstall | update resolvconf for networkmanager
|
||||
|
||||
- name: Set default dns if remove_default_searchdomains is false
|
||||
@@ -21,7 +22,7 @@
|
||||
path: /etc/NetworkManager/conf.d/dns.conf
|
||||
section: global-dns
|
||||
option: searches
|
||||
value: "{{ (default_searchdomains | default([]) + searchdomains | default([])) | join(',') }}"
|
||||
value: "{{ (default_searchdomains | default([]) + searchdomains) | join(',') }}"
|
||||
mode: '0600'
|
||||
backup: true
|
||||
notify: Preinstall | update resolvconf for networkmanager
|
||||
|
||||
Reference in New Issue
Block a user