Fix node registration ip on dual stack

When using a user defined node ip on a dual stack cluster,
k3s_node_ip will contain "ipv4,ipv6" IP. In order to properly set
the registration IP, the first (preferred) IP in the list is used,
and if it is the IPv6 IP it will be URL wrapped.
This commit is contained in:
Logan V 2024-11-29 07:20:02 +00:00
parent 6ff67804dd
commit a6c49dac0c

View File

@ -147,7 +147,7 @@
- name: Ensure the node registration address is defined from node-ip - name: Ensure the node registration address is defined from node-ip
ansible.builtin.set_fact: ansible.builtin.set_fact:
k3s_registration_address: "{{ hostvars[k3s_control_delegate].k3s_node_ip }}" k3s_registration_address: "{{ (hostvars[k3s_control_delegate].k3s_node_ip | split(','))[0] | ipwrap }}"
check_mode: false check_mode: false
when: when:
- k3s_registration_address is not defined - k3s_registration_address is not defined