Merge pull request #1430 from St0rmingBr4in/fix-home

contrib/ansible: Fix home path and use kubectl to set the server url in conf
This commit is contained in:
Erik Wilson 2020-02-24 15:24:33 -07:00 committed by GitHub
commit 9a1f9a8a4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,22 +46,21 @@
- name: Create directory .kube
file:
path: /home/{{ ansible_user }}/.kube
path: ~{{ ansible_user }}/.kube
state: directory
owner: "{{ ansible_user }}"
- name: Copy config file to user home directory
copy:
src: /etc/rancher/k3s/k3s.yaml
dest: /home/{{ ansible_user }}/.kube/config
dest: ~{{ ansible_user }}/.kube/config
remote_src: yes
owner: "{{ ansible_user }}"
- name: Replace https://localhost:6443 by https://master-pi:6443
replace:
path: /home/{{ ansible_user }}/.kube/config
regexp: 'https://localhost:6443'
replace: 'https://{{master_ip}}:6443'
command: k3s kubectl config set-cluster default
--server=https://{{ master_ip }}:6443
--kubeconfig ~{{ ansible_user }}/.kube/config
- name: Create kubectl symlink
file: