mirror of
https://github.com/PyratLabs/ansible-role-k3s
synced 2024-12-13 22:30:20 +01:00
Merge pull request #142 from PyratLabs/fix-k3s_runtime_config
Fix: Define registration address from node-ip
This commit is contained in:
commit
189f2baf23
2 changed files with 10 additions and 2 deletions
|
@ -9,6 +9,8 @@
|
|||
k3s_etcd_datastore: true
|
||||
k3s_server:
|
||||
secrets-encryption: true
|
||||
k3s_agent:
|
||||
node-ip: "{{ ansible_default_ipv4.address }}"
|
||||
pre_tasks:
|
||||
- name: Set each node to be a control node
|
||||
ansible.builtin.set_fact:
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
k3s_control_plane_port: "{{ k3s_runtime_config['https-listen-port'] | default(6443) }}"
|
||||
delegate_to: k3s_primary_control_node
|
||||
|
||||
- name: Ensure k3s node IP is configured when node-ip is defined
|
||||
ansible.builtin.set_fact:
|
||||
k3s_node_ip: "{{ k3s_runtime_config['node-ip'] }}"
|
||||
when:
|
||||
- k3s_runtime_config['node-ip'] is defined
|
||||
|
||||
- name: Ensure a count of control nodes is generated from ansible_play_hosts
|
||||
ansible.builtin.set_fact:
|
||||
k3s_controller_list: "{{ k3s_controller_list + [ item ] }}"
|
||||
|
@ -104,12 +110,12 @@
|
|||
|
||||
- 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'] }}"
|
||||
k3s_registration_address: "{{ hostvars[k3s_control_delegate].k3s_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
|
||||
- hostvars[k3s_control_delegate].k3s_node_ip is defined
|
||||
|
||||
- name: Ensure the node registration address is defined
|
||||
ansible.builtin.set_fact:
|
||||
|
|
Loading…
Reference in a new issue