Switch /root references to ansible_env.HOME (#4842)
* kube config dir for current/ansible become user * remove extra / * fix default valuepull/4849/head
parent
bbdc6210f5
commit
a8dfcbbfc7
|
@ -2,7 +2,7 @@
|
|||
{{ docker_bin_dir }}/docker run --rm \
|
||||
--net=host \
|
||||
--name=helm \
|
||||
-v /root/.kube:/root/.kube:ro \
|
||||
-v {{ ansible_env.HOME | default('/root') }}/.kube:/root/.kube:ro \
|
||||
-v /etc/ssl:/etc/ssl:ro \
|
||||
-v {{ helm_home_dir }}:{{ helm_home_dir }}:rw \
|
||||
{% for dir in ssl_ca_dirs -%}
|
||||
|
|
|
@ -16,16 +16,16 @@
|
|||
tags:
|
||||
- facts
|
||||
|
||||
- name: Create kube config dir
|
||||
- name: Create kube config dir for current/ansible become user
|
||||
file:
|
||||
path: "/root/.kube"
|
||||
path: "{{ ansible_env.HOME | default('/root') }}/.kube"
|
||||
mode: "0700"
|
||||
state: directory
|
||||
|
||||
- name: Copy admin kubeconfig to root user home
|
||||
- name: Copy admin kubeconfig to current/ansible become user home
|
||||
copy:
|
||||
src: "{{ kube_config_dir }}/admin.conf"
|
||||
dest: "/root/.kube/config"
|
||||
dest: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
|
||||
remote_src: yes
|
||||
mode: "0600"
|
||||
backup: yes
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
- name: Master | Copy new kubeconfig for root user
|
||||
copy:
|
||||
src: "{{ kube_config_dir }}/admin.conf"
|
||||
dest: "/root/.kube/config"
|
||||
dest: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
|
||||
remote_src: yes
|
||||
mode: "0600"
|
||||
backup: yes
|
||||
|
|
|
@ -13,5 +13,5 @@
|
|||
|
||||
- name: kubeadm | Purge old kubeconfig
|
||||
file:
|
||||
path: /root/.kube/config
|
||||
path: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
|
||||
state: absent
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
- name: Wait for apiserver
|
||||
shell: "{{ bin_dir }}/kubectl get nodes"
|
||||
environment:
|
||||
- KUBECONFIG: /root/.kube/config
|
||||
- KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
|
||||
register: apiserver_is_ready
|
||||
until: apiserver_is_ready.rc == 0
|
||||
retries: 6
|
||||
|
@ -12,7 +12,7 @@
|
|||
- name: Delete old kube-master nodes from cluster
|
||||
shell: "{{ bin_dir }}/kubectl delete node {{ item }}"
|
||||
environment:
|
||||
- KUBECONFIG: /root/.kube/config
|
||||
- KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
|
||||
with_items: "{{ old_kube_masters.split(',') }}"
|
||||
register: delete_old_kube_masters
|
||||
failed_when: false
|
||||
|
|
|
@ -172,8 +172,8 @@
|
|||
with_items:
|
||||
- "{{ kube_config_dir }}"
|
||||
- /var/lib/kubelet
|
||||
- /root/.kube
|
||||
- /root/.helm
|
||||
- "{{ ansible_env.HOME | default('/root') }}/.kube"
|
||||
- "{{ ansible_env.HOME | default('/root') }}/.helm"
|
||||
- "{{ etcd_data_dir }}"
|
||||
- /var/lib/etcd-events
|
||||
- /etc/ssl/etcd
|
||||
|
|
Loading…
Reference in New Issue