2016-07-08 09:59:21 +00:00
|
|
|
---
|
2017-03-06 10:22:13 +00:00
|
|
|
- name: "Pre-upgrade | etcd3 upgrade | see if old config exists"
|
|
|
|
command: "{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} ls /registry/minions"
|
|
|
|
environment:
|
|
|
|
ETCDCTL_API: 2
|
2019-04-11 19:52:43 +00:00
|
|
|
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem"
|
|
|
|
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem"
|
2017-03-06 10:22:13 +00:00
|
|
|
register: old_data_exists
|
2017-03-23 09:11:30 +00:00
|
|
|
delegate_to: "{{groups['etcd'][0]}}"
|
2017-10-25 20:19:40 +00:00
|
|
|
changed_when: false
|
2017-03-06 10:22:13 +00:00
|
|
|
when: kube_apiserver_storage_backend == "etcd3"
|
|
|
|
failed_when: false
|
|
|
|
|
2017-08-20 10:54:28 +00:00
|
|
|
- name: "Pre-upgrade | etcd3 upgrade | use etcd2 unless forced to etcd3"
|
2017-03-30 13:08:13 +00:00
|
|
|
set_fact:
|
|
|
|
kube_apiserver_storage_backend: "etcd2"
|
|
|
|
when: old_data_exists.rc == 0 and not force_etcd3|bool
|
|
|
|
|
2017-09-15 12:19:37 +00:00
|
|
|
- name: "Pre-upgrade | Delete master manifests"
|
2017-03-27 11:44:21 +00:00
|
|
|
file:
|
2017-09-15 12:19:37 +00:00
|
|
|
path: "/etc/kubernetes/manifests/{{item}}.manifest"
|
2017-03-27 11:44:21 +00:00
|
|
|
state: absent
|
2017-09-25 11:19:04 +00:00
|
|
|
with_items:
|
2017-03-24 15:29:28 +00:00
|
|
|
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
2016-12-13 09:03:35 +00:00
|
|
|
register: kube_apiserver_manifest_replaced
|
2017-09-09 20:41:20 +00:00
|
|
|
when: (secret_changed|default(false) or etcd_secret_changed|default(false))
|
2016-12-13 09:03:35 +00:00
|
|
|
|
2017-09-15 12:19:37 +00:00
|
|
|
- name: "Pre-upgrade | Delete master containers forcefully"
|
2017-11-08 07:40:33 +00:00
|
|
|
shell: "docker ps -af name=k8s_{{item}}* -q | xargs --no-run-if-empty docker rm -f"
|
2017-09-25 11:19:04 +00:00
|
|
|
with_items:
|
2017-03-27 11:44:21 +00:00
|
|
|
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
2017-09-09 20:41:20 +00:00
|
|
|
when: kube_apiserver_manifest_replaced.changed
|
2018-03-29 16:37:32 +00:00
|
|
|
register: remove_master_container
|
|
|
|
retries: 4
|
|
|
|
until: remove_master_container.rc == 0
|
2018-12-25 07:06:27 +00:00
|
|
|
delay: 5
|