mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2026-08-09 07:23:19 +02:00
fix(token): escape percent signs used in k3s token (#682)
- systemd treats % as a specifier in ExecStart, so token values containing % fail with 'failed to resolve unit specifiers invalid slot' - escape % to %% in the agent unit file - escape % to %% in server_init_args so the multi-master bootstrap path (systemd-run k3s-init) handles % tokens too Co-authored-by: finaldoom <677609+FinalDoom@users.noreply.github.com>
This commit is contained in:
@@ -11,7 +11,7 @@ ExecStartPre=-/sbin/modprobe overlay
|
||||
ExecStart=/usr/local/bin/k3s agent \
|
||||
--server https://{{ apiserver_endpoint | ansible.utils.ipwrap }}:6443 \
|
||||
{% if is_pxe_booted | default(false) %}--snapshotter native \
|
||||
{% endif %}--token {{ hostvars[groups[group_name_master | default('master')][0]]['token'] | default(k3s_token) }} \
|
||||
{% endif %}--token {{ hostvars[groups[group_name_master | default('master')][0]]['token'] | default(k3s_token) | replace( '%', '%%' ) }} \
|
||||
{{ extra_agent_args }}
|
||||
KillMode=process
|
||||
Delegate=yes
|
||||
|
||||
@@ -33,7 +33,7 @@ server_init_args: >-
|
||||
{% else %}
|
||||
--server https://{{ hostvars[groups[group_name_master | default('master')][0]].k3s_node_ip | split(",") | first | ansible.utils.ipwrap }}:6443
|
||||
{% endif %}
|
||||
--token {{ k3s_token }}
|
||||
--token {{ k3s_token | replace('%', '%%') }}
|
||||
{% endif %}
|
||||
{{ extra_server_args }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user