2018-12-28 07:27:27 +00:00
|
|
|
---
|
|
|
|
- name: Backup old configuration files
|
|
|
|
copy:
|
|
|
|
src: "{{ kube_config_dir }}/{{ item.src }}"
|
|
|
|
dest: "{{ kube_config_dir }}/{{ item.dest }}"
|
|
|
|
remote_src: yes
|
|
|
|
with_items:
|
|
|
|
- {src: admin.conf, dest: admin.conf.old}
|
|
|
|
- {src: kubelet.conf, dest: kubelet.conf.old}
|
|
|
|
- {src: controller-manager.conf, dest: controller-manager.conf.old}
|
|
|
|
- {src: scheduler.conf, dest: scheduler.conf.old}
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Remove old configuration files
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/{{ item }}"
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- admin.conf
|
|
|
|
- kubelet.conf
|
|
|
|
- controller-manager.conf
|
|
|
|
- scheduler.conf
|
|
|
|
|
|
|
|
- name: Generate new configuration files
|
|
|
|
command: "{{ bin_dir }}/kubeadm init phase kubeconfig all --config={{ kube_config_dir }}/kubeadm-config.yaml"
|
2019-03-26 10:03:19 +00:00
|
|
|
environment: "{{ proxy_env }}"
|
2018-12-28 07:27:27 +00:00
|
|
|
when: kubeadm_version is version('v1.13.0', '>=')
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Generate new configuration files
|
|
|
|
command: "{{ bin_dir }}/kubeadm alpha phase kubeconfig all --config={{ kube_config_dir }}/kubeadm-config.yaml"
|
2019-03-26 10:03:19 +00:00
|
|
|
environment: "{{ proxy_env }}"
|
2018-12-28 07:27:27 +00:00
|
|
|
when: kubeadm_version is version('v1.13.0', '<')
|
|
|
|
ignore_errors: yes
|