2017-08-24 09:09:52 +00:00
|
|
|
---
|
2019-11-06 18:11:52 +00:00
|
|
|
- name: Preinstall | propagate resolvconf to k8s components
|
2016-08-29 14:39:55 +00:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2016-11-30 13:06:11 +00:00
|
|
|
- Preinstall | reload kubelet
|
2017-02-01 04:31:57 +00:00
|
|
|
- Preinstall | kube-controller configured
|
2018-01-30 21:26:07 +00:00
|
|
|
- Preinstall | kube-apiserver configured
|
2019-10-17 01:58:39 +00: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-09 22:09:06 +00:00
|
|
|
- Preinstall | wait for the apiserver to be running
|
2021-10-01 16:11:23 +00:00
|
|
|
when: not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and not is_fedora_coreos
|
2016-08-29 14:39:55 +00:00
|
|
|
|
2020-08-28 09:28:53 +00:00
|
|
|
- name: Preinstall | update resolvconf for Flatcar Container Linux by Kinvolk
|
2016-11-23 14:49:10 +00:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
2016-12-07 15:57:05 +00:00
|
|
|
- Preinstall | apply resolvconf cloud-init
|
|
|
|
- Preinstall | reload kubelet
|
2021-10-01 16:11:23 +00:00
|
|
|
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
2016-09-27 09:54:12 +00:00
|
|
|
|
2016-12-07 15:57:05 +00:00
|
|
|
- name: Preinstall | apply resolvconf cloud-init
|
2016-11-23 14:49:10 +00:00
|
|
|
command: /usr/bin/coreos-cloudinit --from-file {{ resolveconf_cloud_init_conf }}
|
2021-10-01 16:11:23 +00:00
|
|
|
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
2020-06-29 07:26:17 +00:00
|
|
|
|
2022-02-26 18:29:23 +00:00
|
|
|
- name: Preinstall | update resolvconf for networkmanager
|
2020-06-29 07:26:17 +00:00
|
|
|
command: /bin/true
|
|
|
|
notify:
|
|
|
|
- Preinstall | reload NetworkManager
|
|
|
|
- Preinstall | reload kubelet
|
|
|
|
|
2020-08-31 10:30:20 +00:00
|
|
|
- name: Preinstall | reload NetworkManager
|
|
|
|
service:
|
|
|
|
name: NetworkManager.service
|
|
|
|
state: restarted
|
2016-11-23 14:49:10 +00:00
|
|
|
|
2016-12-07 15:57:05 +00:00
|
|
|
- name: Preinstall | reload kubelet
|
2016-09-27 09:54:12 +00:00
|
|
|
service:
|
|
|
|
name: kubelet
|
|
|
|
state: restarted
|
2017-02-01 04:31:57 +00:00
|
|
|
notify:
|
|
|
|
- Preinstall | kube-controller configured
|
2018-01-30 21:26:07 +00:00
|
|
|
- Preinstall | kube-apiserver configured
|
2019-10-17 01:58:39 +00: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-04 17:43:47 +00:00
|
|
|
when: not dns_early|bool
|
2017-02-01 04:31:57 +00:00
|
|
|
|
2018-01-30 21:26:07 +00:00
|
|
|
# FIXME(mattymo): Also restart for kubeadm mode
|
|
|
|
- name: Preinstall | kube-apiserver configured
|
2021-02-10 13:36:59 +00:00
|
|
|
stat:
|
|
|
|
path: "{{ kube_manifest_dir }}/kube-apiserver.manifest"
|
|
|
|
get_attributes: no
|
|
|
|
get_checksum: no
|
|
|
|
get_mime: no
|
2018-01-30 21:26:07 +00:00
|
|
|
register: kube_apiserver_set
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname in groups['kube_control_plane'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
2018-01-30 21:26:07 +00:00
|
|
|
|
|
|
|
# FIXME(mattymo): Also restart for kubeadm mode
|
2017-02-01 04:31:57 +00:00
|
|
|
- name: Preinstall | kube-controller configured
|
2021-02-10 13:36:59 +00:00
|
|
|
stat:
|
|
|
|
path: "{{ kube_manifest_dir }}/kube-controller-manager.manifest"
|
|
|
|
get_attributes: no
|
|
|
|
get_checksum: no
|
|
|
|
get_mime: no
|
2017-02-01 04:31:57 +00:00
|
|
|
register: kube_controller_set
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname in groups['kube_control_plane'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
2017-02-01 04:31:57 +00:00
|
|
|
|
2019-10-17 01:58:39 +00:00
|
|
|
- name: Preinstall | restart kube-controller-manager docker
|
2020-11-28 16:30:47 +00: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 01:58:39 +00:00
|
|
|
when:
|
|
|
|
- container_manager == "docker"
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 01:58:39 +00:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
- kube_controller_set.stat.exists
|
2018-01-30 21:26:07 +00:00
|
|
|
|
2019-10-17 01:58:39 +00:00
|
|
|
- name: Preinstall | restart kube-controller-manager crio/containerd
|
2020-11-28 16:30:47 +00: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 01:58:39 +00:00
|
|
|
when:
|
|
|
|
- container_manager in ['crio', 'containerd']
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 01:58:39 +00:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
- kube_controller_set.stat.exists
|
|
|
|
|
|
|
|
- name: Preinstall | restart kube-apiserver docker
|
2020-11-28 16:30:47 +00: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 01:58:39 +00:00
|
|
|
when:
|
|
|
|
- container_manager == "docker"
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 01:58:39 +00:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
|
|
|
|
- name: Preinstall | restart kube-apiserver crio/containerd
|
2020-11-28 16:30:47 +00: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 %'"
|
2019-10-17 01:58:39 +00:00
|
|
|
when:
|
|
|
|
- container_manager in ['crio', 'containerd']
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname in groups['kube_control_plane']
|
2019-10-17 01:58:39 +00:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
2019-11-06 11:33:52 +00:00
|
|
|
|
2021-12-09 22:09:06 +00: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 11:33:52 +00:00
|
|
|
- name: Preinstall | Restart systemd-resolved
|
|
|
|
service:
|
|
|
|
name: systemd-resolved
|
|
|
|
state: restarted
|