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.

161 lines
6.0 KiB

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