Skip to content

Commit 37bf2f0

Browse files
committed
Copy kubeconfig to ubuntu user home directory for workflow access
1 parent 3120385 commit 37bf2f0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

roles/galaxy_k8s_deployment/tasks/rke2_setup.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,22 @@
5555
- name: Set kubeconfig path fact
5656
ansible.builtin.set_fact:
5757
kubeconfig_path: "/etc/rancher/rke2/rke2.yaml"
58+
59+
- name: Create .kube directory for ubuntu user
60+
ansible.builtin.file:
61+
path: /home/ubuntu/.kube
62+
state: directory
63+
owner: ubuntu
64+
group: ubuntu
65+
mode: '0755'
66+
become: true
67+
68+
- name: Copy kubeconfig to ubuntu user home directory
69+
ansible.builtin.copy:
70+
src: /etc/rancher/rke2/rke2.yaml
71+
dest: /home/ubuntu/.kube/config
72+
owner: ubuntu
73+
group: ubuntu
74+
mode: '0600'
75+
remote_src: true
76+
become: true

0 commit comments

Comments
 (0)