fix: only manage kubeconfig on primary control plane
This commit is contained in:
@@ -140,16 +140,26 @@
|
|||||||
{{ k3s_journal.stdout | default('n/a') }}
|
{{ k3s_journal.stdout | default('n/a') }}
|
||||||
when: k3s_ready is failed
|
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
|
- name: Copy kubeconfig to default location for root
|
||||||
file:
|
file:
|
||||||
src: /etc/rancher/k3s/k3s.yaml
|
src: /etc/rancher/k3s/k3s.yaml
|
||||||
dest: /root/.kube/config
|
dest: /root/.kube/config
|
||||||
state: link
|
state: link
|
||||||
force: true
|
force: true
|
||||||
|
when: k3s_primary | default(false)
|
||||||
|
|
||||||
- name: Ensure .kube directory exists for ansible user
|
- name: Ensure .kube directory exists for ansible user
|
||||||
file:
|
file:
|
||||||
path: "/home/{{ ansible_user }}/.kube"
|
path: "/home/{{ ansible_user }}/.kube"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
when: ansible_user != 'root'
|
when:
|
||||||
|
- ansible_user != 'root'
|
||||||
|
- k3s_primary | default(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user