mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-13 21:34:40 +03:00
Calling bootstrap in facts.yaml so that we can always collect facts even on new nodes. This is useful when you want to add nodes to an inventory beforehand and then collect facts and scale the cluster with the scale playbook and --limits. With dynamic inventory sometimes it might be more difficult to add the nodes after running the facts playbook in this specific situation. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
124 lines
4.3 KiB
YAML
124 lines
4.3 KiB
YAML
---
|
|
- name: Check ansible version
|
|
import_playbook: ansible_version.yml
|
|
|
|
- name: Ensure compatibility with old groups
|
|
import_playbook: legacy_groups.yml
|
|
|
|
- hosts: bastion[0]
|
|
gather_facts: False
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
|
|
|
|
- name: Gather facts
|
|
tags: always
|
|
import_playbook: facts.yml
|
|
|
|
- hosts: k8s_cluster:etcd
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: kubernetes/preinstall, tags: preinstall }
|
|
- { role: "container-engine", tags: "container-engine", when: deploy_container_engine }
|
|
- { role: download, tags: download, when: "not skip_downloads" }
|
|
|
|
- hosts: etcd:kube_control_plane
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- role: etcd
|
|
tags: etcd
|
|
vars:
|
|
etcd_cluster_setup: true
|
|
etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
|
|
when: etcd_deployment_type != "kubeadm"
|
|
|
|
- hosts: k8s_cluster
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- role: etcd
|
|
tags: etcd
|
|
vars:
|
|
etcd_cluster_setup: false
|
|
etcd_events_cluster_setup: false
|
|
when:
|
|
- etcd_deployment_type != "kubeadm"
|
|
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
|
|
- kube_network_plugin != "calico" or calico_datastore == "etcd"
|
|
|
|
- hosts: k8s_cluster
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: kubernetes/node, tags: node }
|
|
|
|
- hosts: kube_control_plane
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: kubernetes/control-plane, tags: master }
|
|
- { role: kubernetes/client, tags: client }
|
|
- { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
|
|
|
|
- hosts: k8s_cluster
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: kubernetes/kubeadm, tags: kubeadm}
|
|
- { role: kubernetes/node-label, tags: node-label }
|
|
- { role: network_plugin, tags: network }
|
|
- { role: kubernetes-apps/kubelet-csr-approver, tags: kubelet-csr-approver }
|
|
|
|
- hosts: calico_rr
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: network_plugin/calico/rr, tags: ['network', 'calico_rr'] }
|
|
|
|
- hosts: kube_control_plane[0]
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] }
|
|
|
|
- hosts: kube_control_plane
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: kubernetes-apps/external_cloud_controller, tags: external-cloud-controller }
|
|
- { role: kubernetes-apps/network_plugin, tags: network }
|
|
- { role: kubernetes-apps/policy_controller, tags: policy-controller }
|
|
- { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
|
|
- { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
|
|
- { role: kubernetes-apps, tags: apps }
|
|
|
|
- name: Apply resolv.conf changes now that cluster DNS is up
|
|
hosts: k8s_cluster
|
|
gather_facts: False
|
|
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
|
environment: "{{ proxy_disable_env }}"
|
|
roles:
|
|
- { role: kubespray-defaults }
|
|
- { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }
|