mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-23 14:06:03 -03:30
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.
39 lines
1.5 KiB
YAML
39 lines
1.5 KiB
YAML
---
|
|
- name: NetworkManager | Add nameservers to NM configuration
|
|
community.general.ini_file:
|
|
path: /etc/NetworkManager/conf.d/dns.conf
|
|
section: global-dns-domain-*
|
|
option: servers
|
|
value: "{{ nameserverentries | join(',') }}"
|
|
mode: '0600'
|
|
backup: true
|
|
when:
|
|
- ('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
|
|
set_fact:
|
|
default_searchdomains: ["default.svc.{{ dns_domain }}", "svc.{{ dns_domain }}"]
|
|
when: not remove_default_searchdomains | default() | bool or (remove_default_searchdomains | default() | bool and searchdomains | default([]) | length==0)
|
|
|
|
- name: NetworkManager | Add DNS search to NM configuration
|
|
community.general.ini_file:
|
|
path: /etc/NetworkManager/conf.d/dns.conf
|
|
section: global-dns
|
|
option: searches
|
|
value: "{{ (default_searchdomains | default([]) + searchdomains) | join(',') }}"
|
|
mode: '0600'
|
|
backup: true
|
|
notify: Preinstall | update resolvconf for networkmanager
|
|
|
|
- name: NetworkManager | Add DNS options to NM configuration
|
|
community.general.ini_file:
|
|
path: /etc/NetworkManager/conf.d/dns.conf
|
|
section: global-dns
|
|
option: options
|
|
value: "ndots:{{ ndots }},timeout:{{ dns_timeout | default('2') }},attempts:{{ dns_attempts | default('2') }}"
|
|
mode: '0600'
|
|
backup: true
|
|
notify: Preinstall | update resolvconf for networkmanager
|