2017-08-24 17:09:52 +08:00
|
|
|
---
|
2019-11-07 02:11:52 +08:00
|
|
|
- name: Preinstall | propagate resolvconf to k8s components
|
2016-08-29 22:39:55 +08:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2016-11-30 21:06:11 +08:00
|
|
|
- Preinstall | reload kubelet
|
2017-02-01 12:31:57 +08:00
|
|
|
- Preinstall | kube-controller configured
|
2018-01-31 05:26:07 +08:00
|
|
|
- Preinstall | kube-apiserver configured
|
2019-10-17 09:58:39 +08:00
|
|
|
- Preinstall | restart kube-controller-manager docker
|
|
|
|
- Preinstall | restart kube-controller-manager crio/containerd
|
|
|
|
- Preinstall | restart kube-apiserver docker
|
|
|
|
- Preinstall | restart kube-apiserver crio/containerd
|
2021-12-10 06:09:06 +08:00
|
|
|
- Preinstall | wait for the apiserver to be running
|
2021-10-02 00:11:23 +08:00
|
|
|
when: not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and not is_fedora_coreos
|
2016-08-29 22:39:55 +08:00
|
|
|
|
2020-08-28 17:28:53 +08:00
|
|
|
- name: Preinstall | update resolvconf for Flatcar Container Linux by Kinvolk
|
2016-11-23 22:49:10 +08:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2016-12-07 23:57:05 +08:00
|
|
|
- Preinstall | apply resolvconf cloud-init
|
|
|
|
- Preinstall | reload kubelet
|
2021-10-02 00:11:23 +08:00
|
|
|
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
2016-09-27 17:54:12 +08:00
|
|
|
|
2016-12-07 23:57:05 +08:00
|
|
|
- name: Preinstall | apply resolvconf cloud-init
|
2016-11-23 22:49:10 +08:00
|
|
|
command: /usr/bin/coreos-cloudinit --from-file {{ resolveconf_cloud_init_conf }}
|
2021-10-02 00:11:23 +08:00
|
|
|
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
2020-06-29 15:26:17 +08:00
|
|
|
|
2022-02-27 02:29:23 +08:00
|
|
|
- name: Preinstall | update resolvconf for networkmanager
|
2020-06-29 15:26:17 +08:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
|
|
|
- Preinstall | reload NetworkManager
|
|
|
|
- Preinstall | reload kubelet
|
|
|
|
|
2020-08-31 18:30:20 +08:00
|
|
|
- name: Preinstall | reload NetworkManager
|
|
|
|
service:
|
|
|
|
name: NetworkManager.service
|
|
|
|
state: restarted
|
2016-11-23 22:49:10 +08:00
|
|
|
|
2016-12-07 23:57:05 +08:00
|
|
|
- name: Preinstall | reload kubelet
|
2016-09-27 17:54:12 +08:00
|
|
|
service:
|
|
|
|
name: kubelet
|
|
|
|
state: restarted
|
2017-02-01 12:31:57 +08:00
|
|
|
notify:
|
|
|
|
- Preinstall | kube-controller configured
|
2018-01-31 05:26:07 +08:00
|
|
|
- Preinstall | kube-apiserver configured
|
2019-10-17 09:58:39 +08:00
|
|
|
- Preinstall | restart kube-controller-manager docker
|
|
|
|
- Preinstall | restart kube-controller-manager crio/containerd
|
|
|
|
- Preinstall | restart kube-apiserver docker
|
|
|
|
- Preinstall | restart kube-apiserver crio/containerd
|
2017-04-05 01:43:47 +08:00
|
|
|
when: not dns_early|bool
|
2017-02-01 12:31:57 +08:00
|
|
|
|
2018-01-31 05:26:07 +08:00
|
|
|
# FIXME(mattymo): Also restart for kubeadm mode
|
|
|
|
- name: Preinstall | kube-apiserver configured
|
2021-02-10 21:36:59 +08:00
|
|
|
stat:
|
2023-04-10 10:51:15 +08:00
|
|
|
path: "{{ kube_manifest_dir }}/kube-apiserver.yaml"
|
2021-02-10 21:36:59 +08:00
|
|
|
get_attributes: no
|
|
|
|
get_checksum: no
|
|
|
|
get_mime: no
|
2018-01-31 05:26:07 +08:00
|
|
|
register: kube_apiserver_set
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname in groups['kube_control_plane'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
2018-01-31 05:26:07 +08:00
|
|
|
|
|
|
|
# FIXME(mattymo): Also restart for kubeadm mode
|
2017-02-01 12:31:57 +08:00
|
|
|
- name: Preinstall | kube-controller configured
|
2021-02-10 21:36:59 +08:00
|
|
|
stat:
|
2023-04-10 10:51:15 +08:00
|
|
|
path: "{{ kube_manifest_dir }}/kube-controller-manager.yaml"
|
2021-02-10 21:36:59 +08:00
|
|
|
get_attributes: no
|
|
|
|
get_checksum: no
|
|
|
|
get_mime: no
|
2017-02-01 12:31:57 +08:00
|
|
|
register: kube_controller_set
|
2021-03-24 08:26:05 +08:00
|
|
|
when: inventory_hostname in groups['kube_control_plane'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
2017-02-01 12:31:57 +08:00
|
|
|
|
2019-10-17 09:58:39 +08:00
|
|
|
- name: Preinstall | restart kube-controller-manager docker
|
2020-11-29 00:30:47 +08:00
|
|
|
shell: "{{ docker_bin_dir }}/docker ps -f name=k8s_POD_kube-controller-manager* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
|
2019-10-17 09:58:39 +08:00
|
|
|
when:
|
|
|
|
- container_manager == "docker"
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 09:58:39 +08:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
- kube_controller_set.stat.exists
|
2018-01-31 05:26:07 +08:00
|
|
|
|
2019-10-17 09:58:39 +08:00
|
|
|
- name: Preinstall | restart kube-controller-manager crio/containerd
|
2020-11-29 00:30:47 +08:00
|
|
|
shell: "{{ bin_dir }}/crictl pods --name kube-controller-manager* -q | xargs -I% --no-run-if-empty bash -c '{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %'"
|
2019-10-17 09:58:39 +08:00
|
|
|
when:
|
|
|
|
- container_manager in ['crio', 'containerd']
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 09:58:39 +08:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
- kube_controller_set.stat.exists
|
|
|
|
|
|
|
|
- name: Preinstall | restart kube-apiserver docker
|
2020-11-29 00:30:47 +08:00
|
|
|
shell: "{{ docker_bin_dir }}/docker ps -f name=k8s_POD_kube-apiserver* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
|
2019-10-17 09:58:39 +08:00
|
|
|
when:
|
|
|
|
- container_manager == "docker"
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 09:58:39 +08:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
2023-04-10 10:51:15 +08:00
|
|
|
- kube_apiserver_set.stat.exists
|
2019-10-17 09:58:39 +08:00
|
|
|
|
|
|
|
- name: Preinstall | restart kube-apiserver crio/containerd
|
2020-11-29 00:30:47 +08:00
|
|
|
shell: "{{ bin_dir }}/crictl pods --name kube-apiserver* -q | xargs -I% --no-run-if-empty bash -c '{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %'"
|
2022-09-08 07:48:49 +08:00
|
|
|
register: preinstall_restart_apiserver
|
|
|
|
retries: 10
|
|
|
|
until: preinstall_restart_apiserver.rc == 0
|
|
|
|
delay: 1
|
2019-10-17 09:58:39 +08:00
|
|
|
when:
|
|
|
|
- container_manager in ['crio', 'containerd']
|
2021-03-24 08:26:05 +08:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 09:58:39 +08:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
2023-04-10 10:51:15 +08:00
|
|
|
- kube_apiserver_set.stat.exists
|
2019-11-06 19:33:52 +08:00
|
|
|
|
2021-12-10 06:09:06 +08:00
|
|
|
# When running this as the last phase ensure we wait for kube-apiserver to come up
|
|
|
|
- name: Preinstall | wait for the apiserver to be running
|
|
|
|
uri:
|
|
|
|
url: "{{ kube_apiserver_endpoint }}/healthz"
|
|
|
|
validate_certs: no
|
|
|
|
register: result
|
|
|
|
until: result.status == 200
|
|
|
|
retries: 60
|
|
|
|
delay: 1
|
|
|
|
when:
|
|
|
|
- dns_late
|
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
|
2019-11-06 19:33:52 +08:00
|
|
|
- name: Preinstall | Restart systemd-resolved
|
|
|
|
service:
|
|
|
|
name: systemd-resolved
|
|
|
|
state: restarted
|
2022-06-29 04:15:34 +08:00
|
|
|
|
|
|
|
- name: Preinstall | restart ntp
|
|
|
|
service:
|
|
|
|
name: "{{ ntp_service_name }}"
|
|
|
|
state: restarted
|
|
|
|
when: ntp_enabled
|