2 - name: Check ansible version
3 import_playbook: ansible_version.yml
5 - name: Ensure compatibility with old groups
6 import_playbook: legacy_groups.yml
10 environment: "{{ proxy_disable_env }}"
12 - { role: kubespray-defaults }
13 - { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
15 - name: Bootstrap any new workers
18 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
20 environment: "{{ proxy_disable_env }}"
22 - { role: kubespray-defaults }
23 - { role: bootstrap-os, tags: bootstrap-os }
27 import_playbook: facts.yml
29 - name: Generate the etcd certificates beforehand
32 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
33 environment: "{{ proxy_disable_env }}"
35 - { role: kubespray-defaults }
36 - { role: etcd, tags: etcd, etcd_cluster_setup: false }
38 - name: Download images to ansible host cache via first kube_control_plane node
39 hosts: kube_control_plane[0]
41 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
42 environment: "{{ proxy_disable_env }}"
44 - { role: kubespray-defaults, when: "not skip_downloads and download_run_once and not download_localhost" }
45 - { role: kubernetes/preinstall, tags: preinstall, when: "not skip_downloads and download_run_once and not download_localhost" }
46 - { role: download, tags: download, when: "not skip_downloads and download_run_once and not download_localhost" }
48 - name: Target only workers to get kubelet installed and checking in on any new nodes(engine)
51 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
52 environment: "{{ proxy_disable_env }}"
54 - { role: kubespray-defaults }
55 - { role: kubernetes/preinstall, tags: preinstall }
56 - { role: container-engine, tags: "container-engine", when: deploy_container_engine }
57 - { role: download, tags: download, when: "not skip_downloads" }
58 - { role: etcd, tags: etcd, etcd_cluster_setup: false, when: "etcd_deployment_type != 'kubeadm'" }
60 - name: Target only workers to get kubelet installed and checking in on any new nodes(node)
63 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
64 environment: "{{ proxy_disable_env }}"
66 - { role: kubespray-defaults }
67 - { role: kubernetes/node, tags: node }
69 - name: Upload control plane certs and retrieve encryption key
70 hosts: kube_control_plane | first
71 environment: "{{ proxy_disable_env }}"
75 - { role: kubespray-defaults }
77 - name: Upload control plane certificates
79 {{ bin_dir }}/kubeadm init phase
80 --config {{ kube_config_dir }}/kubeadm-config.yaml
83 environment: "{{ proxy_disable_env }}"
84 register: kubeadm_upload_cert
86 - name: set fact 'kubeadm_certificate_key' for later use
88 kubeadm_certificate_key: "{{ kubeadm_upload_cert.stdout_lines[-1] | trim }}"
89 when: kubeadm_certificate_key is not defined
91 - name: Target only workers to get kubelet installed and checking in on any new nodes(network)
94 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
95 environment: "{{ proxy_disable_env }}"
97 - { role: kubespray-defaults }
98 - { role: kubernetes/kubeadm, tags: kubeadm }
99 - { role: kubernetes/node-label, tags: node-label }
100 - { role: network_plugin, tags: network }
102 - name: Apply resolv.conf changes now that cluster DNS is up
105 any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
106 environment: "{{ proxy_disable_env }}"
108 - { role: kubespray-defaults }
109 - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }