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.

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