mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-25 06:56:07 -03:30
Fixes https://github.com/kubernetes-sigs/kubespray/issues/10947 This patch aims to be minimal and intentionally: - does not change the generation logic for `supersede_domain` and `supersede_search` - does not change how `nameserverentries` (for NetworkManager) is built It seems like `nameserverentries` in the "Generate nameservers for resolvconf, including cluster DNS" task is built the same way as `dhclient_supersede_nameserver_entries_list`. However, `nameserverentries` in the "Generate nameservers for resolvconf, not including cluster DNS" task (below) is built differently for some reason. It includes `configured_nameservers` as well. Due to these differences, I have refrained from reusing the same building logic (`dhclient_supersede_nameserver_entries_list`) for both. If the `configured_nameservers` addition can be removed or made to apply to dhclient as well, we could potentially build a single list and then generate the `nameserverentries` and `supersede_nameserver` strings from it.
34 lines
1.0 KiB
YAML
34 lines
1.0 KiB
YAML
---
|
|
- name: Configure dhclient to supersede search/domain/nameservers
|
|
blockinfile:
|
|
block: |-
|
|
{% for item in [supersede_domain, supersede_search, supersede_nameserver] | reject('equalto', '') -%}
|
|
{{ item }}
|
|
{% endfor %}
|
|
path: "{{ dhclientconffile }}"
|
|
create: yes
|
|
state: present
|
|
insertbefore: BOF
|
|
backup: yes
|
|
marker: "# Ansible entries {mark}"
|
|
mode: "0644"
|
|
notify: Preinstall | propagate resolvconf to k8s components
|
|
|
|
- name: Configure dhclient hooks for resolv.conf (non-RH)
|
|
template:
|
|
src: dhclient_dnsupdate.sh.j2
|
|
dest: "{{ dhclienthookfile }}"
|
|
owner: root
|
|
mode: "0755"
|
|
notify: Preinstall | propagate resolvconf to k8s components
|
|
when: ansible_os_family not in [ "RedHat", "Suse" ]
|
|
|
|
- name: Configure dhclient hooks for resolv.conf (RH-only)
|
|
template:
|
|
src: dhclient_dnsupdate_rh.sh.j2
|
|
dest: "{{ dhclienthookfile }}"
|
|
owner: root
|
|
mode: "0755"
|
|
notify: Preinstall | propagate resolvconf to k8s components
|
|
when: ansible_os_family == "RedHat"
|