fetch kubeconfig from master after deployment (#431)

Co-authored-by: Techno Tim <timothystewart6@gmail.com>
This commit is contained in:
Gereon VeyandTechno Tim authored and GitHub committed 2024-01-27 16:30:13 -06:00
1 parent 3888a29bb1
commit 3f06a11c8d
2 files changed
+12

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
.env/
*.log
ansible.cfg
kubeconfig
+11
View File
@@ -46,3 +46,14 @@
roles:
- role: k3s_server_post
become: true
- name: Storing kubeconfig in the playbook directory
hosts: master
environment: "{{ proxy_env | default({}) }}"
tasks:
- name: Copying kubeconfig from {{ hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname'] }}
ansible.builtin.fetch:
src: "{{ ansible_user_dir }}/.kube/config"
dest: ./kubeconfig
flat: true
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']