Make kubectl binary configurable with the k3s_kubectl_binary parameter

Closes techno-tim/k3s-ansible#566

Signed-off-by: Christian Berendt <berendt@osism.tech>
This commit is contained in:
Christian Berendt
2024-08-20 09:21:25 +02:00
parent 3a0303d130
commit d67c69cbf5
6 changed files with 23 additions and 18 deletions

View File

@@ -44,7 +44,7 @@
block:
- name: Verify that all nodes actually joined (check k3s-init.service if this fails)
ansible.builtin.command:
cmd: k3s kubectl get nodes -l "node-role.kubernetes.io/master=true" -o=jsonpath="{.items[*].metadata.name}"
cmd: "{{ k3s_kubectl_binary }} get nodes -l 'node-role.kubernetes.io/master=true' -o=jsonpath='{.items[*].metadata.name}'"
register: nodes
until: nodes.rc == 0 and (nodes.stdout.split() | length) == (groups[group_name_master | default('master')] | length) # yamllint disable-line rule:line-length
retries: "{{ retry_count | default(20) }}"
@@ -124,7 +124,7 @@
- name: Configure kubectl cluster to {{ endpoint_url }}
ansible.builtin.command: >-
k3s kubectl config set-cluster default
{{ k3s_kubectl_binary }} config set-cluster default
--server={{ endpoint_url }}
--kubeconfig {{ ansible_user_dir }}/.kube/config
changed_when: true