Merge pull request #142 from PyratLabs/fix-k3s_runtime_config

Fix: Define registration address from node-ip
This commit is contained in:
Xan Manning 2021-08-18 21:08:42 +01:00 committed by GitHub
commit 189f2baf23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -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:

View File

@ -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: