-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathkubeadm_init.yaml
More file actions
34 lines (29 loc) · 1.28 KB
/
kubeadm_init.yaml
File metadata and controls
34 lines (29 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
- name: Check if kubeadm init has been performed
stat:
path: /etc/kubernetes/admin.conf
register: check_k8s_admin_conf_file
changed_when: false
- name: Notify if kubeadm init has been performed already
debug:
msg: |-
kubeadm init has been performed already.
when: check_k8s_admin_conf_file.stat.exists
- name: Notify if kubeadm init has not been performed yet.
debug:
msg: |-
kubeadm init has not been performed yet. Proceeding with kubeadm init.
when: not check_k8s_admin_conf_file.stat.exists
- name: kubeadm init for Single Control Plane Setup
become: true
command: kubeadm init --pod-network-cidr={{ k8s_pod_network_cidr }} --apiserver-advertise-address={{ ansible_facts['env'].SSH_CONNECTION.split(' ')[2] }}
when:
- not check_k8s_admin_conf_file.stat.exists
- k8s_control_plane_endpoint is not defined or k8s_control_plane_endpoint | length == 0
- name: kubeadm init for HA Control Plane Setup
become: true
command: kubeadm init --pod-network-cidr={{ k8s_pod_network_cidr }} --control-plane-endpoint {{ k8s_control_plane_endpoint }}
when:
- not check_k8s_admin_conf_file.stat.exists
- k8s_control_plane_endpoint is defined
- k8s_control_plane_endpoint | length > 0
############################ EOF ###################################