File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 55 k3s_token : " {{ os_metadata.meta.k3s_token }}"
66 k3s_server_name : " {{ os_metadata.meta.control_address }}"
77 service_name : " {{ 'k3s-agent' if k3s_server_name is defined else 'k3s' }}"
8+ access_ip : " {{ os_metadata.meta.access_ip }}"
89 tasks :
910 - name : Ensure password directory exists
1011 ansible.builtin.file :
2223 path : " /etc/systemd/system/{{ service_name }}.service.env"
2324 line : " K3S_TOKEN={{ k3s_token }}"
2425
26+ - name : Add the node IP to the environment
27+ # NB this isn't natively setable via envvars, have to modify
28+ # INSTALL_K3S_EXEC to support it
29+ ansible.builtin.lineinfile :
30+ path : " /etc/systemd/system/{{ service_name }}.service.env"
31+ line : " K3S_NODE_IP={{ access_ip }}"
32+
2533 - name : Add server url to agents
2634 ansible.builtin.lineinfile :
2735 path : " /etc/systemd/system/{{ service_name }}.service.env"
Original file line number Diff line number Diff line change 4747 cmd : /usr/bin/k3s-install.sh
4848 environment :
4949 INSTALL_K3S_VERSION : " {{ k3s_version }}"
50- INSTALL_K3S_EXEC : " {{ item }}"
50+ INSTALL_K3S_EXEC : " {{ item }} --node-ip=${K3S_NODE_IP} "
5151 INSTALL_K3S_SKIP_START : " true"
5252 INSTALL_K3S_SKIP_ENABLE : " true"
5353 INSTALL_K3S_BIN_DIR : " /usr/bin"
You can’t perform that action at this time.
0 commit comments