mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-05-20 07:17:45 -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:
@@ -1,9 +1,10 @@
|
||||
---
|
||||
- name: Configure dhclient to supersede search/domain/nameservers
|
||||
blockinfile:
|
||||
# 1 is the 2nd item of a tuple in items()
|
||||
block: |-
|
||||
{% for item in [supersede_domain, supersede_search, supersede_nameserver] | reject('equalto', '') -%}
|
||||
{{ item }}
|
||||
{% for key, val in dhclient_supersede.items() | rejectattr(1, '==', []) -%}
|
||||
supersede {{ key }} {{ val | join(',') }};
|
||||
{% endfor %}
|
||||
path: "{{ dhclientconffile }}"
|
||||
create: true
|
||||
|
||||
Reference in New Issue
Block a user