Skip to content

Commit e040631

Browse files
authored
fixed bootstrap tokens not being idempotent (#597)
1 parent ac3a31c commit e040631

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ansible/roles/k3s/tasks/server-runtime.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
delay: 10
2323
until: not _k3s_connected_nodes.failed
2424

25-
- name: Generate new bootstrap token if not all agents are connected
26-
no_log: true
27-
when: _k3s_connected_nodes.stdout_lines | length != groups['k3s'] | length
28-
shell:
29-
cmd: "k3s token create --ttl {{ k3s_bootstrap_token_expiry }}"
30-
register: _k3s_token_output
25+
- when: _k3s_connected_nodes.stdout_lines | length != groups['k3s'] | length
26+
block:
27+
- name: Generate new bootstrap token if not all agents are connected
28+
no_log: true
29+
shell:
30+
cmd: "k3s token create --ttl {{ k3s_bootstrap_token_expiry }}"
31+
register: _k3s_token_output
3132

32-
- name: Set bootstrap token as fact
33-
set_fact:
34-
k3s_bootstrap_token: "{{ _k3s_token_output.stdout }}"
33+
- name: Set bootstrap token as fact
34+
set_fact:
35+
k3s_bootstrap_token: "{{ _k3s_token_output.stdout }}"

0 commit comments

Comments
 (0)