Skip to content

Commit

Permalink
don't need to check if an existing config exists
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Nola <[email protected]>
  • Loading branch information
roivanov and dereknola authored Dec 1, 2023
1 parent 4c4491c commit 4175d52
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions roles/k3s_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,13 @@
dest: ~/.kube/config.new
flat: true

- name: Check existing kube config
ansible.builtin.stat:
path: ~/.kube/config
register: result
delegate_to: 127.0.0.1
become: false

- name: Merge with existing kube config
- name: Merge with any existing kube config
ansible.builtin.shell: |
export KUBECONFIG=~/.kube/config:~/.kube/config.new
TFILE=$(mktemp)
kubectl config view --flatten > ${TFILE}
KUBECONFIG=~/.kube/config:~/.kube/config.new kubectl config view --flatten > ${TFILE}
mv ${TFILE} ~/.kube/config
rm ~/.kube/config.new
delegate_to: 127.0.0.1
when: result.stat.exists
become: false
register: mv_result
changed_when:
Expand Down

0 comments on commit 4175d52

Please sign in to comment.