blob: dd784b357340adc3d230f4edaf566b708292e9ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
---
- name: get master vars
set_fact:
kube_bootstrap_token: "{{ hostvars[kubernetes_nodes_master].kube_bootstrap_token }}"
kube_bootstrap_ca_cert_hash: "{{ hostvars[kubernetes_nodes_master].kube_bootstrap_ca_cert_hash }}"
kube_master_addr: "{{ kubernetes.api_advertise_ip | default(hostvars[kubernetes_nodes_master].ansible_default_ipv4.address) }}"
- name: join kubernetes node
command: "kubeadm join --token {{ kube_bootstrap_token }} {{ kube_master_addr }}:6443 --discovery-token-ca-cert-hash {{ kube_bootstrap_ca_cert_hash }}"
args:
creates: /etc/kubernetes/kubelet.conf
register: kubeadm_join
- name: dump output of kubeadm join to log file
when: kubeadm_join.changed
copy:
content: "{{ kubeadm_join.stdout }}\n"
dest: /etc/kubernetes/kubeadm-join.log
|