089201ef44144109c07ce4617d69f5aac4b2b10c
[it/test.git] / XTesting / kubespray / scale.yml
1 ---
2 - name: Check ansible version
3   import_playbook: ansible_version.yml
4
5 - name: Ensure compatibility with old groups
6   import_playbook: legacy_groups.yml
7
8 - hosts: bastion[0]
9   gather_facts: False
10   environment: "{{ proxy_disable_env }}"
11   roles:
12     - { role: kubespray-defaults }
13     - { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
14
15 - name: Bootstrap any new workers
16   hosts: kube_node
17   strategy: linear
18   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
19   gather_facts: false
20   environment: "{{ proxy_disable_env }}"
21   roles:
22     - { role: kubespray-defaults }
23     - { role: bootstrap-os, tags: bootstrap-os }
24
25 - name: Gather facts
26   tags: always
27   import_playbook: facts.yml
28
29 - name: Generate the etcd certificates beforehand
30   hosts: etcd
31   gather_facts: False
32   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
33   environment: "{{ proxy_disable_env }}"
34   roles:
35     - { role: kubespray-defaults }
36     - { role: etcd, tags: etcd, etcd_cluster_setup: false }
37
38 - name: Download images to ansible host cache via first kube_control_plane node
39   hosts: kube_control_plane[0]
40   gather_facts: False
41   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
42   environment: "{{ proxy_disable_env }}"
43   roles:
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" }
47
48 - name: Target only workers to get kubelet installed and checking in on any new nodes(engine)
49   hosts: kube_node
50   gather_facts: False
51   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
52   environment: "{{ proxy_disable_env }}"
53   roles:
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'" }
59
60 - name: Target only workers to get kubelet installed and checking in on any new nodes(node)
61   hosts: kube_node
62   gather_facts: False
63   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
64   environment: "{{ proxy_disable_env }}"
65   roles:
66     - { role: kubespray-defaults }
67     - { role: kubernetes/node, tags: node }
68
69 - name: Upload control plane certs and retrieve encryption key
70   hosts: kube_control_plane | first
71   environment: "{{ proxy_disable_env }}"
72   gather_facts: False
73   tags: kubeadm
74   roles:
75     - { role: kubespray-defaults }
76   tasks:
77     - name: Upload control plane certificates
78       command: >-
79         {{ bin_dir }}/kubeadm init phase
80         --config {{ kube_config_dir }}/kubeadm-config.yaml
81         upload-certs
82         --upload-certs
83       environment: "{{ proxy_disable_env }}"
84       register: kubeadm_upload_cert
85       changed_when: false
86     - name: set fact 'kubeadm_certificate_key' for later use
87       set_fact:
88         kubeadm_certificate_key: "{{ kubeadm_upload_cert.stdout_lines[-1] | trim }}"
89       when: kubeadm_certificate_key is not defined
90
91 - name: Target only workers to get kubelet installed and checking in on any new nodes(network)
92   hosts: kube_node
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: kubernetes/kubeadm, tags: kubeadm }
99     - { role: kubernetes/node-label, tags: node-label }
100     - { role: network_plugin, tags: network }
101
102 - name: Apply resolv.conf changes now that cluster DNS is up
103   hosts: k8s_cluster
104   gather_facts: False
105   any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
106   environment: "{{ proxy_disable_env }}"
107   roles:
108     - { role: kubespray-defaults }
109     - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }