mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-15 22:34:21 +03:00
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.
35 lines
1.1 KiB
YAML
35 lines
1.1 KiB
YAML
---
|
|
- name: Configure dhclient to supersede search/domain/nameservers
|
|
blockinfile:
|
|
# 1 is the 2nd item of a tuple in items()
|
|
block: |-
|
|
{% for key, val in dhclient_supersede.items() | rejectattr(1, '==', []) -%}
|
|
supersede {{ key }} {{ val | join(',') }};
|
|
{% endfor %}
|
|
path: "{{ dhclientconffile }}"
|
|
create: true
|
|
state: present
|
|
insertbefore: BOF
|
|
backup: true
|
|
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"
|