diff --git a/tasks/build/preconfigure-k3s.yml b/tasks/build/preconfigure-k3s.yml index ec25125..4c73d7d 100644 --- a/tasks/build/preconfigure-k3s.yml +++ b/tasks/build/preconfigure-k3s.yml @@ -102,6 +102,15 @@ check_mode: false when: k3s_control_node_address is defined + - name: Ensure the node registration address is defined from node-ip + ansible.builtin.set_fact: + k3s_registration_address: "{{ hostvars[k3s_control_delegate].k3s_runtime_config['node-ip'] }}" + check_mode: false + when: + - k3s_registration_address is not defined + - k3s_control_node_address is not defined + - hostvars[k3s_control_delegate].k3s_runtime_config['node-ip'] is defined + - name: Ensure the node registration address is defined ansible.builtin.set_fact: k3s_registration_address: "{{ hostvars[k3s_control_delegate].ansible_host | default(hostvars[k3s_control_delegate].ansible_fqdn) }}" @@ -113,13 +122,6 @@ when: k3s_registration_address is not defined or k3s_control_delegate is not defined -- name: Ensure k3s_runtime_config is set for control plane - ansible.builtin.set_fact: - k3s_runtime_config: "{{ (k3s_server | default({})) | combine((k3s_agent | default({}))) }}" - when: - - (k3s_server is defined or k3s_agent is defined) - - (k3s_control_node is defined and k3s_control_node) - - name: Ensure k3s_runtime_config is set for agents ansible.builtin.set_fact: k3s_runtime_config: "{{ (k3s_agent | default({})) }}"