used combined configuration from vars.yaml, removed duplicated task for control plane

This commit is contained in:
Xan Manning 2021-08-14 14:04:56 +01:00
parent c0ec5ca930
commit f198b45d58

View file

@ -102,23 +102,14 @@
check_mode: false
when: k3s_control_node_address is defined
- name: Ensure the node registration address is defined from server node ip
- name: Ensure the node registration address is defined from node-ip
ansible.builtin.set_fact:
k3s_registration_address: "{{ hostvars[k3s_control_delegate].k3s_server['node-ip'] }}"
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_server['node-ip'] is defined
- name: Ensure the node registration address is defined from agent node ip
ansible.builtin.set_fact:
k3s_registration_address: "{{ hostvars[k3s_control_delegate].k3s_agent['node-ip'] }}"
check_mode: false
when:
- k3s_registration_address is not defined
- k3s_control_node_address is not defined
- hostvars[k3s_control_delegate].k3s_agent['node-ip'] is defined
- hostvars[k3s_control_delegate].k3s_runtime_config['node-ip'] is defined
- name: Ensure the node registration address is defined
ansible.builtin.set_fact:
@ -131,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({})) }}"