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