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.

128 lines
5.4 KiB

  1. ---
  2. - name: Common tasks for every playbooks
  3. import_playbook: boilerplate.yml
  4. - name: Gather facts
  5. import_playbook: facts.yml
  6. - name: Download images to ansible host cache via first kube_control_plane node
  7. hosts: kube_control_plane[0]
  8. gather_facts: False
  9. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  10. environment: "{{ proxy_disable_env }}"
  11. roles:
  12. - { role: kubespray-defaults, when: "not skip_downloads and download_run_once and not download_localhost"}
  13. - { role: kubernetes/preinstall, tags: preinstall, when: "not skip_downloads and download_run_once and not download_localhost" }
  14. - { role: download, tags: download, when: "not skip_downloads and download_run_once and not download_localhost" }
  15. - name: Prepare nodes for upgrade
  16. hosts: k8s_cluster:etcd:calico_rr
  17. gather_facts: False
  18. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  19. environment: "{{ proxy_disable_env }}"
  20. roles:
  21. - { role: kubespray-defaults }
  22. - { role: kubernetes/preinstall, tags: preinstall }
  23. - { role: download, tags: download, when: "not skip_downloads" }
  24. - name: Upgrade container engine on non-cluster nodes
  25. hosts: etcd:calico_rr:!k8s_cluster
  26. gather_facts: False
  27. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  28. environment: "{{ proxy_disable_env }}"
  29. serial: "{{ serial | default('20%') }}"
  30. roles:
  31. - { role: kubespray-defaults }
  32. - { role: container-engine, tags: "container-engine", when: deploy_container_engine }
  33. - name: Install etcd
  34. import_playbook: install_etcd.yml
  35. - name: Handle upgrades to master components first to maintain backwards compat.
  36. gather_facts: False
  37. hosts: kube_control_plane
  38. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  39. environment: "{{ proxy_disable_env }}"
  40. serial: 1
  41. roles:
  42. - { role: kubespray-defaults }
  43. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  44. - { role: upgrade/system-upgrade, tags: system-upgrade }
  45. - { role: download, tags: download, when: "system_upgrade and system_upgrade_reboot != 'never' and not skip_downloads" }
  46. - { role: kubernetes-apps/kubelet-csr-approver, tags: kubelet-csr-approver }
  47. - { role: container-engine, tags: "container-engine", when: deploy_container_engine }
  48. - { role: kubernetes/node, tags: node }
  49. - { role: kubernetes/control-plane, tags: master, upgrade_cluster_setup: true }
  50. - { role: kubernetes/client, tags: client }
  51. - { role: kubernetes/node-label, tags: node-label }
  52. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  53. - { role: kubernetes-apps, tags: csi-driver }
  54. - { role: upgrade/post-upgrade, tags: post-upgrade }
  55. - name: Upgrade calico and external cloud provider on all masters, calico-rrs, and nodes
  56. hosts: kube_control_plane:calico_rr:kube_node
  57. gather_facts: False
  58. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  59. serial: "{{ serial | default('20%') }}"
  60. environment: "{{ proxy_disable_env }}"
  61. roles:
  62. - { role: kubespray-defaults }
  63. - { role: kubernetes-apps/external_cloud_controller, tags: external-cloud-controller }
  64. - { role: network_plugin, tags: network }
  65. - { role: kubernetes-apps/network_plugin, tags: network }
  66. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  67. - name: Finally handle worker upgrades, based on given batch size
  68. hosts: kube_node:calico_rr:!kube_control_plane
  69. gather_facts: False
  70. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  71. environment: "{{ proxy_disable_env }}"
  72. serial: "{{ serial | default('20%') }}"
  73. roles:
  74. - { role: kubespray-defaults }
  75. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  76. - { role: upgrade/system-upgrade, tags: system-upgrade }
  77. - { role: download, tags: download, when: "system_upgrade and system_upgrade_reboot != 'never' and not skip_downloads" }
  78. - { role: container-engine, tags: "container-engine", when: deploy_container_engine }
  79. - { role: kubernetes/node, tags: node }
  80. - { role: kubernetes/kubeadm, tags: kubeadm }
  81. - { role: kubernetes/node-label, tags: node-label }
  82. - { role: upgrade/post-upgrade, tags: post-upgrade }
  83. - name: Patch Kubernetes for Windows
  84. hosts: kube_control_plane[0]
  85. gather_facts: False
  86. any_errors_fatal: true
  87. environment: "{{ proxy_disable_env }}"
  88. roles:
  89. - { role: kubespray-defaults }
  90. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] }
  91. - name: Install Calico Route Reflector
  92. hosts: calico_rr
  93. gather_facts: False
  94. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  95. environment: "{{ proxy_disable_env }}"
  96. roles:
  97. - { role: kubespray-defaults }
  98. - { role: network_plugin/calico/rr, tags: network }
  99. - name: Install Kubernetes apps
  100. hosts: kube_control_plane
  101. gather_facts: False
  102. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  103. environment: "{{ proxy_disable_env }}"
  104. roles:
  105. - { role: kubespray-defaults }
  106. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  107. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  108. - { role: kubernetes-apps, tags: apps }
  109. - name: Apply resolv.conf changes now that cluster DNS is up
  110. hosts: k8s_cluster
  111. gather_facts: False
  112. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  113. environment: "{{ proxy_disable_env }}"
  114. roles:
  115. - { role: kubespray-defaults }
  116. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }