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.

55 lines
1.4 KiB

  1. ---
  2. - name: Set kubelet api version to v1beta1
  3. set_fact:
  4. kubeletConfig_api_version: v1beta1
  5. tags:
  6. - kubelet
  7. - kubeadm
  8. - name: Write kubelet environment config file (kubeadm)
  9. template:
  10. src: "kubelet.env.{{ kubeletConfig_api_version }}.j2"
  11. dest: "{{ kube_config_dir }}/kubelet.env"
  12. setype: "{{ (preinstall_selinux_state != 'disabled') | ternary('etc_t', omit) }}"
  13. backup: yes
  14. mode: 0600
  15. notify: Node | restart kubelet
  16. tags:
  17. - kubelet
  18. - kubeadm
  19. - name: Write kubelet config file
  20. template:
  21. src: "kubelet-config.{{ kubeletConfig_api_version }}.yaml.j2"
  22. dest: "{{ kube_config_dir }}/kubelet-config.yaml"
  23. mode: 0600
  24. notify: Kubelet | restart kubelet
  25. tags:
  26. - kubelet
  27. - kubeadm
  28. - name: Write kubelet systemd init file
  29. template:
  30. src: "kubelet.service.j2"
  31. dest: "/etc/systemd/system/kubelet.service"
  32. backup: "yes"
  33. mode: 0600
  34. validate: "sh -c '[ -f /usr/bin/systemd/system/factory-reset.target ] || exit 0 && systemd-analyze verify %s:kubelet.service'"
  35. # FIXME: check that systemd version >= 250 (factory-reset.target was introduced in that release)
  36. # Remove once we drop support for systemd < 250
  37. notify: Node | restart kubelet
  38. tags:
  39. - kubelet
  40. - kubeadm
  41. - name: Flush_handlers and reload-systemd
  42. meta: flush_handlers
  43. - name: Enable kubelet
  44. service:
  45. name: kubelet
  46. enabled: yes
  47. state: started
  48. tags:
  49. - kubelet
  50. notify: Kubelet | restart kubelet