mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2024-09-27 03:52:39 +02:00
do not blindly overwrite kube config (#263)
* do not blindly overwrite kube config Signed-off-by: Roman Ivanov <me@roivanov.com> * don't need to check if an existing config exists Co-authored-by: Derek Nola <derek.nola@suse.com> Signed-off-by: Roman Ivanov <me@roivanov.com>
This commit is contained in:
parent
34bf054f94
commit
ec02f1cafd
@ -91,9 +91,21 @@
|
|||||||
- name: Copy kubectl config to local machine
|
- name: Copy kubectl config to local machine
|
||||||
ansible.builtin.fetch:
|
ansible.builtin.fetch:
|
||||||
src: ~{{ ansible_user }}/.kube/config
|
src: ~{{ ansible_user }}/.kube/config
|
||||||
dest: ~/.kube/config
|
dest: ~/.kube/config.new
|
||||||
flat: true
|
flat: true
|
||||||
|
|
||||||
|
- name: Merge with any existing kube config
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
TFILE=$(mktemp)
|
||||||
|
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
|
||||||
|
become: false
|
||||||
|
register: mv_result
|
||||||
|
changed_when:
|
||||||
|
- mv_result.rc == 0
|
||||||
|
|
||||||
- name: Start other server if any and verify status
|
- name: Start other server if any and verify status
|
||||||
when:
|
when:
|
||||||
- (groups['server'] | length) > 1
|
- (groups['server'] | length) > 1
|
||||||
|
Loading…
Reference in New Issue
Block a user