fix: only manage kubeconfig on primary control plane
Some checks failed
Deploy Cluster / Terraform (push) Successful in 20s
Deploy Cluster / Ansible (push) Failing after 4m31s

This commit is contained in:
2026-03-01 03:02:37 +00:00
parent b703cb269b
commit f0dd31c552

View File

@@ -140,16 +140,26 @@
{{ k3s_journal.stdout | default('n/a') }}
when: k3s_ready is failed
- name: Copy kubeconfig to default location for root
file:
path: /root/.kube
state: directory
mode: "0700"
when: k3s_primary | default(false)
- name: Copy kubeconfig to default location for root
file:
src: /etc/rancher/k3s/k3s.yaml
dest: /root/.kube/config
state: link
force: true
when: k3s_primary | default(false)
- name: Ensure .kube directory exists for ansible user
file:
path: "/home/{{ ansible_user }}/.kube"
state: directory
mode: "0755"
when: ansible_user != 'root'
when:
- ansible_user != 'root'
- k3s_primary | default(false)