You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.9 KiB

  1. ---
  2. - name: Preinstall | propagate resolvconf to k8s components
  3. command: /bin/true
  4. notify:
  5. - Preinstall | reload kubelet
  6. - Preinstall | kube-controller configured
  7. - Preinstall | kube-apiserver configured
  8. - Preinstall | restart kube-controller-manager docker
  9. - Preinstall | restart kube-controller-manager crio/containerd
  10. - Preinstall | restart kube-apiserver docker
  11. - Preinstall | restart kube-apiserver crio/containerd
  12. when: not ansible_os_family in ["Flatcar Container Linux by Kinvolk"] and not is_fedora_coreos
  13. - name: Preinstall | update resolvconf for Flatcar Container Linux by Kinvolk
  14. command: /bin/true
  15. notify:
  16. - Preinstall | apply resolvconf cloud-init
  17. - Preinstall | reload kubelet
  18. when: ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
  19. - name: Preinstall | apply resolvconf cloud-init
  20. command: /usr/bin/coreos-cloudinit --from-file {{ resolveconf_cloud_init_conf }}
  21. when: ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
  22. - name: Preinstall | update resolvconf for Fedora CoreOS
  23. command: /bin/true
  24. notify:
  25. - Preinstall | reload NetworkManager
  26. - Preinstall | reload kubelet
  27. when: is_fedora_coreos
  28. - name: Preinstall | reload NetworkManager
  29. service:
  30. name: NetworkManager.service
  31. state: restarted
  32. when: is_fedora_coreos
  33. - name: Preinstall | reload kubelet
  34. service:
  35. name: kubelet
  36. state: restarted
  37. notify:
  38. - Preinstall | kube-controller configured
  39. - Preinstall | kube-apiserver configured
  40. - Preinstall | restart kube-controller-manager docker
  41. - Preinstall | restart kube-controller-manager crio/containerd
  42. - Preinstall | restart kube-apiserver docker
  43. - Preinstall | restart kube-apiserver crio/containerd
  44. when: not dns_early|bool
  45. # FIXME(mattymo): Also restart for kubeadm mode
  46. - name: Preinstall | kube-apiserver configured
  47. stat: path="{{ kube_manifest_dir }}/kube-apiserver.manifest"
  48. register: kube_apiserver_set
  49. when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
  50. # FIXME(mattymo): Also restart for kubeadm mode
  51. - name: Preinstall | kube-controller configured
  52. stat: path="{{ kube_manifest_dir }}/kube-controller-manager.manifest"
  53. register: kube_controller_set
  54. when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
  55. - name: Preinstall | restart kube-controller-manager docker
  56. shell: "docker ps -f name=k8s_POD_kube-controller-manager* -q | xargs --no-run-if-empty docker rm -f"
  57. when:
  58. - container_manager == "docker"
  59. - inventory_hostname in groups['kube-master']
  60. - dns_mode != 'none'
  61. - resolvconf_mode == 'host_resolvconf'
  62. - kube_controller_set.stat.exists
  63. - name: Preinstall | restart kube-controller-manager crio/containerd
  64. shell: crictl pods --name kube-controller-manager* -q | xargs -I% --no-run-if-empty bash -c 'crictl stopp % && crictl rmp %'
  65. when:
  66. - container_manager in ['crio', 'containerd']
  67. - inventory_hostname in groups['kube-master']
  68. - dns_mode != 'none'
  69. - resolvconf_mode == 'host_resolvconf'
  70. - kube_controller_set.stat.exists
  71. - name: Preinstall | restart kube-apiserver docker
  72. shell: "docker ps -f name=k8s_POD_kube-apiserver* -q | xargs --no-run-if-empty docker rm -f"
  73. when:
  74. - container_manager == "docker"
  75. - inventory_hostname in groups['kube-master']
  76. - dns_mode != 'none'
  77. - resolvconf_mode == 'host_resolvconf'
  78. - name: Preinstall | restart kube-apiserver crio/containerd
  79. shell: crictl pods --name kube-apiserver* -q | xargs -I% --no-run-if-empty bash -c 'crictl stopp % && crictl rmp %'
  80. when:
  81. - container_manager in ['crio', 'containerd']
  82. - inventory_hostname in groups['kube-master']
  83. - dns_mode != 'none'
  84. - resolvconf_mode == 'host_resolvconf'
  85. - name: Preinstall | Restart systemd-resolved
  86. service:
  87. name: systemd-resolved
  88. state: restarted