c12s-kubespray/roles/recover_control_plane/master/tasks/main.yml
mervynzhang a8dfcbbfc7 Switch /root references to ansible_env.HOME (#4842)
* kube config dir for current/ansible become user

* remove extra /

* fix default value
2019-06-06 02:06:11 -07:00

28 lines
928 B
YAML

---
- name: Wait for apiserver
shell: "{{ bin_dir }}/kubectl get nodes"
environment:
- KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
register: apiserver_is_ready
until: apiserver_is_ready.rc == 0
retries: 6
delay: 10
changed_when: false
- name: Delete old kube-master nodes from cluster
shell: "{{ bin_dir }}/kubectl delete node {{ item }}"
environment:
- KUBECONFIG: "{{ ansible_env.HOME | default('/root') }}/.kube/config"
with_items: "{{ old_kube_masters.split(',') }}"
register: delete_old_kube_masters
failed_when: false
when: old_kube_masters is defined
- name: Fail if unable to delete old kube-master nodes from cluster
fail:
msg: "Unable to delete old kube-master node: {{ item.item }}"
loop: "{{ delete_old_kube_masters.results }}"
changed_when: false
when:
- old_kube_masters is defined
- "item.rc != 0 and not 'NotFound' in item.stderr"