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.

164 lines
6.1 KiB

6 years ago
  1. ---
  2. - name: Check ansible version
  3. import_playbook: ansible_version.yml
  4. - name: Ensure compatibility with old groups
  5. import_playbook: legacy_groups.yml
  6. - hosts: bastion[0]
  7. gather_facts: False
  8. environment: "{{ proxy_disable_env }}"
  9. roles:
  10. - { role: kubespray-defaults }
  11. - { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
  12. - hosts: k8s_cluster:etcd:calico_rr
  13. strategy: linear
  14. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  15. gather_facts: false
  16. environment: "{{ proxy_disable_env }}"
  17. vars:
  18. # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining
  19. # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled.
  20. ansible_ssh_pipelining: false
  21. roles:
  22. - { role: kubespray-defaults }
  23. - { role: bootstrap-os, tags: bootstrap-os}
  24. - name: Gather facts
  25. tags: always
  26. import_playbook: facts.yml
  27. - name: Download images to ansible host cache via first kube_control_plane node
  28. hosts: kube_control_plane[0]
  29. gather_facts: False
  30. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  31. environment: "{{ proxy_disable_env }}"
  32. roles:
  33. - { role: kubespray-defaults, when: "not skip_downloads and download_run_once and not download_localhost"}
  34. - { role: kubernetes/preinstall, tags: preinstall, when: "not skip_downloads and download_run_once and not download_localhost" }
  35. - { role: download, tags: download, when: "not skip_downloads and download_run_once and not download_localhost" }
  36. - name: Prepare nodes for upgrade
  37. hosts: k8s_cluster:etcd:calico_rr
  38. gather_facts: False
  39. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  40. environment: "{{ proxy_disable_env }}"
  41. roles:
  42. - { role: kubespray-defaults }
  43. - { role: kubernetes/preinstall, tags: preinstall }
  44. - { role: download, tags: download, when: "not skip_downloads" }
  45. - name: Upgrade container engine on non-cluster nodes
  46. hosts: etcd:calico_rr:!k8s_cluster
  47. gather_facts: False
  48. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  49. environment: "{{ proxy_disable_env }}"
  50. serial: "{{ serial | default('20%') }}"
  51. roles:
  52. - { role: kubespray-defaults }
  53. - { role: container-engine, tags: "container-engine", when: deploy_container_engine }
  54. - hosts: etcd
  55. gather_facts: False
  56. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  57. environment: "{{ proxy_disable_env }}"
  58. roles:
  59. - { role: kubespray-defaults }
  60. - role: etcd
  61. tags: etcd
  62. vars:
  63. etcd_cluster_setup: true
  64. etcd_events_cluster_setup: false
  65. when: not etcd_kubeadm_enabled | default(false)
  66. - hosts: k8s_cluster
  67. gather_facts: False
  68. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  69. environment: "{{ proxy_disable_env }}"
  70. roles:
  71. - { role: kubespray-defaults }
  72. - role: etcd
  73. tags: etcd
  74. vars:
  75. etcd_cluster_setup: false
  76. etcd_events_cluster_setup: false
  77. when: not etcd_kubeadm_enabled | default(false)
  78. - name: Handle upgrades to master components first to maintain backwards compat.
  79. gather_facts: False
  80. hosts: kube_control_plane
  81. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  82. environment: "{{ proxy_disable_env }}"
  83. serial: 1
  84. roles:
  85. - { role: kubespray-defaults }
  86. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  87. - { role: container-engine, tags: "container-engine", when: deploy_container_engine }
  88. - { role: kubernetes/node, tags: node }
  89. - { role: kubernetes/control-plane, tags: master, upgrade_cluster_setup: true }
  90. - { role: kubernetes/client, tags: client }
  91. - { role: kubernetes/node-label, tags: node-label }
  92. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  93. - { role: kubernetes-apps, tags: csi-driver }
  94. - { role: upgrade/post-upgrade, tags: post-upgrade }
  95. - name: Upgrade calico and external cloud provider on all masters, calico-rrs, and nodes
  96. hosts: kube_control_plane:calico_rr:kube_node
  97. gather_facts: False
  98. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  99. serial: "{{ serial | default('20%') }}"
  100. environment: "{{ proxy_disable_env }}"
  101. roles:
  102. - { role: kubespray-defaults }
  103. - { role: kubernetes-apps/external_cloud_controller, tags: external-cloud-controller }
  104. - { role: network_plugin, tags: network }
  105. - { role: kubernetes-apps/network_plugin, tags: network }
  106. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  107. - name: Finally handle worker upgrades, based on given batch size
  108. hosts: kube_node:calico_rr:!kube_control_plane
  109. gather_facts: False
  110. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  111. environment: "{{ proxy_disable_env }}"
  112. serial: "{{ serial | default('20%') }}"
  113. roles:
  114. - { role: kubespray-defaults }
  115. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  116. - { role: container-engine, tags: "container-engine", when: deploy_container_engine }
  117. - { role: kubernetes/node, tags: node }
  118. - { role: kubernetes/kubeadm, tags: kubeadm }
  119. - { role: kubernetes/node-label, tags: node-label }
  120. - { role: upgrade/post-upgrade, tags: post-upgrade }
  121. - hosts: kube_control_plane[0]
  122. gather_facts: False
  123. any_errors_fatal: true
  124. environment: "{{ proxy_disable_env }}"
  125. roles:
  126. - { role: kubespray-defaults }
  127. - { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] }
  128. - hosts: calico_rr
  129. gather_facts: False
  130. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  131. environment: "{{ proxy_disable_env }}"
  132. roles:
  133. - { role: kubespray-defaults }
  134. - { role: network_plugin/calico/rr, tags: network }
  135. - hosts: kube_control_plane
  136. gather_facts: False
  137. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  138. environment: "{{ proxy_disable_env }}"
  139. roles:
  140. - { role: kubespray-defaults }
  141. - { role: kubernetes-apps, tags: apps }
  142. - hosts: k8s_cluster
  143. gather_facts: False
  144. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  145. environment: "{{ proxy_disable_env }}"
  146. roles:
  147. - { role: kubespray-defaults }
  148. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf }