2017-08-24 17:09:52 +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"]
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | update resolvconf for Flatcar Container Linux by Kinvolk
|
2020-06-29 15:26:17 +08:00
|
|
|
|
2020-08-31 18:30:20 +08:00
|
|
|
- name: Preinstall | reload NetworkManager
|
|
|
|
service:
|
|
|
|
name: NetworkManager.service
|
|
|
|
state: restarted
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | update resolvconf for networkmanager
|
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
|
2023-07-05 11:36:54 +08:00
|
|
|
when: not dns_early | bool
|
2023-11-08 19:28:30 +08:00
|
|
|
listen:
|
|
|
|
- Preinstall | propagate resolvconf to k8s components
|
|
|
|
- Preinstall | update resolvconf for Flatcar Container Linux by Kinvolk
|
|
|
|
- Preinstall | update resolvconf for networkmanager
|
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"
|
2024-08-28 13:30:56 +08:00
|
|
|
get_attributes: false
|
|
|
|
get_checksum: false
|
|
|
|
get_mime: false
|
2018-01-31 05:26:07 +08:00
|
|
|
register: kube_apiserver_set
|
2024-09-21 20:09:09 +08:00
|
|
|
when: ('kube_control_plane' in group_names) and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | propagate resolvconf to k8s components
|
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"
|
2024-08-28 13:30:56 +08:00
|
|
|
get_attributes: false
|
|
|
|
get_checksum: false
|
|
|
|
get_mime: false
|
2017-02-01 12:31:57 +08:00
|
|
|
register: kube_controller_set
|
2024-09-21 20:09:09 +08:00
|
|
|
when: ('kube_control_plane' in group_names) and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | propagate resolvconf to k8s components
|
2017-02-01 12:31:57 +08:00
|
|
|
|
2019-10-17 09:58:39 +08:00
|
|
|
- name: Preinstall | restart kube-controller-manager docker
|
2023-06-26 18:15:45 +08:00
|
|
|
shell: "set -o pipefail && {{ docker_bin_dir }}/docker ps -f name=k8s_POD_kube-controller-manager* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2019-10-17 09:58:39 +08:00
|
|
|
when:
|
|
|
|
- container_manager == "docker"
|
2024-09-21 20:09:09 +08:00
|
|
|
- ('kube_control_plane' in group_names)
|
2019-10-17 09:58:39 +08:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
- kube_controller_set.stat.exists
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | propagate resolvconf to k8s components
|
2018-01-31 05:26:07 +08:00
|
|
|
|
2019-10-17 09:58:39 +08:00
|
|
|
- name: Preinstall | restart kube-controller-manager crio/containerd
|
2023-06-26 18:15:45 +08:00
|
|
|
shell: "set -o pipefail && {{ 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 %'"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2023-04-26 04:04:16 +08:00
|
|
|
register: preinstall_restart_controller_manager
|
|
|
|
retries: 10
|
|
|
|
delay: 1
|
|
|
|
until: preinstall_restart_controller_manager.rc == 0
|
2019-10-17 09:58:39 +08:00
|
|
|
when:
|
|
|
|
- container_manager in ['crio', 'containerd']
|
2024-09-21 20:09:09 +08:00
|
|
|
- ('kube_control_plane' in group_names)
|
2019-10-17 09:58:39 +08:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
|
|
|
- kube_controller_set.stat.exists
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | propagate resolvconf to k8s components
|
2019-10-17 09:58:39 +08:00
|
|
|
|
|
|
|
- name: Preinstall | restart kube-apiserver docker
|
2023-06-26 18:15:45 +08:00
|
|
|
shell: "set -o pipefail && {{ docker_bin_dir }}/docker ps -f name=k8s_POD_kube-apiserver* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2019-10-17 09:58:39 +08:00
|
|
|
when:
|
|
|
|
- container_manager == "docker"
|
2024-09-21 20:09:09 +08:00
|
|
|
- ('kube_control_plane' in group_names)
|
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
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | propagate resolvconf to k8s components
|
2019-10-17 09:58:39 +08:00
|
|
|
|
|
|
|
- name: Preinstall | restart kube-apiserver crio/containerd
|
2023-06-26 18:15:45 +08:00
|
|
|
shell: "set -o pipefail && {{ bin_dir }}/crictl pods --name kube-apiserver* -q | xargs -I% --no-run-if-empty bash -c '{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %'"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
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']
|
2024-09-21 20:09:09 +08:00
|
|
|
- ('kube_control_plane' in group_names)
|
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
|
2023-11-08 19:28:30 +08:00
|
|
|
listen: Preinstall | propagate resolvconf to k8s components
|
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"
|
2024-08-28 13:30:56 +08:00
|
|
|
validate_certs: false
|
2021-12-10 06:09:06 +08:00
|
|
|
register: result
|
|
|
|
until: result.status == 200
|
|
|
|
retries: 60
|
|
|
|
delay: 1
|
|
|
|
when:
|
|
|
|
- dns_late
|
2024-09-21 20:09:09 +08:00
|
|
|
- ('kube_control_plane' in group_names)
|
2021-12-10 06:09:06 +08:00
|
|
|
- dns_mode != 'none'
|
|
|
|
- resolvconf_mode == 'host_resolvconf'
|
2023-11-08 19:28:30 +08:00
|
|
|
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and not is_fedora_coreos
|
|
|
|
listen: Preinstall | propagate resolvconf to k8s components
|
2021-12-10 06:09:06 +08:00
|
|
|
|
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
|