control-plane: refactor group membership test

Testing with group_names does not require the groups to exist.
This commit is contained in:
Max Gautier
2024-09-23 16:09:07 +02:00
parent 0679d9c8e9
commit fbcc8cc336
2 changed files with 2 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ nodeRegistration:
{% if kube_override_hostname | default('') %}
name: "{{ kube_override_hostname }}"
{% endif %}
{% if inventory_hostname in groups['kube_control_plane'] and inventory_hostname not in groups['kube_node'] %}
{% if 'kube_control_plane' in group_names and 'kube_node' not in group_names %}
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane