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.

132 lines
4.6 KiB

  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. - name: Install bastion ssh config
  7. hosts: bastion[0]
  8. gather_facts: False
  9. environment: "{{ proxy_disable_env }}"
  10. roles:
  11. - { role: kubespray-defaults }
  12. - { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
  13. - name: Gather facts
  14. import_playbook: facts.yml
  15. - name: Prepare for etcd install
  16. hosts: k8s_cluster:etcd
  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: "container-engine", tags: "container-engine", when: deploy_container_engine }
  24. - { role: download, tags: download, when: "not skip_downloads" }
  25. - name: Install etcd
  26. hosts: etcd:kube_control_plane
  27. gather_facts: False
  28. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  29. environment: "{{ proxy_disable_env }}"
  30. roles:
  31. - { role: kubespray-defaults }
  32. - role: etcd
  33. tags: etcd
  34. vars:
  35. etcd_cluster_setup: true
  36. etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
  37. when: etcd_deployment_type != "kubeadm"
  38. - name: Install etcd certs on nodes if required
  39. hosts: k8s_cluster
  40. gather_facts: False
  41. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  42. environment: "{{ proxy_disable_env }}"
  43. roles:
  44. - { role: kubespray-defaults }
  45. - role: etcd
  46. tags: etcd
  47. vars:
  48. etcd_cluster_setup: false
  49. etcd_events_cluster_setup: false
  50. when:
  51. - etcd_deployment_type != "kubeadm"
  52. - kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
  53. - kube_network_plugin != "calico" or calico_datastore == "etcd"
  54. - name: Install Kubernetes nodes
  55. hosts: k8s_cluster
  56. gather_facts: False
  57. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  58. environment: "{{ proxy_disable_env }}"
  59. roles:
  60. - { role: kubespray-defaults }
  61. - { role: kubernetes/node, tags: node }
  62. - name: Install the control plane
  63. hosts: kube_control_plane
  64. gather_facts: False
  65. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  66. environment: "{{ proxy_disable_env }}"
  67. roles:
  68. - { role: kubespray-defaults }
  69. - { role: kubernetes/control-plane, tags: master }
  70. - { role: kubernetes/client, tags: client }
  71. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  72. - name: Invoke kubeadm and install a CNI
  73. hosts: k8s_cluster
  74. gather_facts: False
  75. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  76. environment: "{{ proxy_disable_env }}"
  77. roles:
  78. - { role: kubespray-defaults }
  79. - { role: kubernetes/kubeadm, tags: kubeadm}
  80. - { role: kubernetes/node-label, tags: node-label }
  81. - { role: network_plugin, tags: network }
  82. - { role: kubernetes-apps/kubelet-csr-approver, tags: kubelet-csr-approver }
  83. - name: Install Calico Route Reflector
  84. hosts: calico_rr
  85. gather_facts: False
  86. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  87. environment: "{{ proxy_disable_env }}"
  88. roles:
  89. - { role: kubespray-defaults }
  90. - { role: network_plugin/calico/rr, tags: ['network', 'calico_rr'] }
  91. - name: Patch Kubernetes for Windows
  92. hosts: kube_control_plane[0]
  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: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] }
  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/external_cloud_controller, tags: external-cloud-controller }
  107. - { role: kubernetes-apps/network_plugin, tags: network }
  108. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  109. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  110. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  111. - { role: kubernetes-apps, tags: apps }
  112. - name: Apply resolv.conf changes now that cluster DNS is up
  113. hosts: k8s_cluster
  114. gather_facts: False
  115. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  116. environment: "{{ proxy_disable_env }}"
  117. roles:
  118. - { role: kubespray-defaults }
  119. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }