fix: only manage kubeconfig on primary control plane
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user