mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2024-11-14 10:15:24 +01:00
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:
commit
3d738d887a
@ -46,22 +46,21 @@
|
|||||||
|
|
||||||
- name: Create directory .kube
|
- name: Create directory .kube
|
||||||
file:
|
file:
|
||||||
path: /home/{{ ansible_user }}/.kube
|
path: ~{{ ansible_user }}/.kube
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ ansible_user }}"
|
owner: "{{ ansible_user }}"
|
||||||
|
|
||||||
- name: Copy config file to user home directory
|
- name: Copy config file to user home directory
|
||||||
copy:
|
copy:
|
||||||
src: /etc/rancher/k3s/k3s.yaml
|
src: /etc/rancher/k3s/k3s.yaml
|
||||||
dest: /home/{{ ansible_user }}/.kube/config
|
dest: ~{{ ansible_user }}/.kube/config
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
owner: "{{ ansible_user }}"
|
owner: "{{ ansible_user }}"
|
||||||
|
|
||||||
- name: Replace https://localhost:6443 by https://master-pi:6443
|
- name: Replace https://localhost:6443 by https://master-pi:6443
|
||||||
replace:
|
command: k3s kubectl config set-cluster default
|
||||||
path: /home/{{ ansible_user }}/.kube/config
|
--server=https://{{ master_ip }}:6443
|
||||||
regexp: 'https://localhost:6443'
|
--kubeconfig ~{{ ansible_user }}/.kube/config
|
||||||
replace: 'https://{{master_ip}}:6443'
|
|
||||||
|
|
||||||
- name: Create kubectl symlink
|
- name: Create kubectl symlink
|
||||||
file:
|
file:
|
||||||
|
Loading…
Reference in New Issue
Block a user