2020-06-29 15:26:17 +08:00
|
|
|
---
|
|
|
|
- name: NetworkManager | Add nameservers to NM configuration
|
2023-06-26 18:15:45 +08:00
|
|
|
community.general.ini_file:
|
2020-09-07 17:27:41 +08:00
|
|
|
path: /etc/NetworkManager/conf.d/dns.conf
|
|
|
|
section: global-dns-domain-*
|
|
|
|
option: servers
|
2022-02-27 02:29:23 +08:00
|
|
|
value: "{{ nameserverentries }}"
|
2020-06-29 15:26:17 +08:00
|
|
|
mode: '0600'
|
|
|
|
backup: yes
|
2023-08-08 15:50:12 +08:00
|
|
|
when:
|
|
|
|
- nameserverentries != "127.0.0.53" or systemd_resolved_enabled.rc != 0
|
2022-02-27 02:29:23 +08:00
|
|
|
notify: Preinstall | update resolvconf for networkmanager
|
2020-06-29 15:26:17 +08:00
|
|
|
|
2023-07-26 22:36:22 +08:00
|
|
|
- name: Set default dns if remove_default_searchdomains is false
|
2022-09-24 01:28:26 +08:00
|
|
|
set_fact:
|
|
|
|
default_searchdomains: ["default.svc.{{ dns_domain }}", "svc.{{ dns_domain }}"]
|
2023-07-05 11:36:54 +08:00
|
|
|
when: not remove_default_searchdomains | default() | bool or (remove_default_searchdomains | default() | bool and searchdomains | default([]) | length==0)
|
2022-09-24 01:28:26 +08:00
|
|
|
|
2020-06-29 15:26:17 +08:00
|
|
|
- name: NetworkManager | Add DNS search to NM configuration
|
2023-06-26 18:15:45 +08:00
|
|
|
community.general.ini_file:
|
2020-09-07 17:27:41 +08:00
|
|
|
path: /etc/NetworkManager/conf.d/dns.conf
|
|
|
|
section: global-dns
|
|
|
|
option: searches
|
2023-07-05 11:36:54 +08:00
|
|
|
value: "{{ (default_searchdomains | default([]) + searchdomains | default([])) | join(',') }}"
|
2020-06-29 15:26:17 +08:00
|
|
|
mode: '0600'
|
|
|
|
backup: yes
|
2022-02-27 02:29:23 +08:00
|
|
|
notify: Preinstall | update resolvconf for networkmanager
|
2020-06-29 15:26:17 +08:00
|
|
|
|
|
|
|
- name: NetworkManager | Add DNS options to NM configuration
|
2023-06-26 18:15:45 +08:00
|
|
|
community.general.ini_file:
|
2020-09-07 17:27:41 +08:00
|
|
|
path: /etc/NetworkManager/conf.d/dns.conf
|
|
|
|
section: global-dns
|
|
|
|
option: options
|
2023-07-05 11:36:54 +08:00
|
|
|
value: "ndots:{{ ndots }},timeout:{{ dns_timeout | default('2') }},attempts:{{ dns_attempts | default('2') }}"
|
2020-06-29 15:26:17 +08:00
|
|
|
mode: '0600'
|
|
|
|
backup: yes
|
2022-02-27 02:29:23 +08:00
|
|
|
notify: Preinstall | update resolvconf for networkmanager
|