blob: 9f0057f9c234c4d23415d1cf8b92b480985970fe (
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_master].kube_bootstrap_token }}"
kube_bootstrap_ca_cert_hash: "{{ hostvars[kubernetes_master].kube_bootstrap_ca_cert_hash }}"
kube_master_addr: "{{ kubernetes.api_advertise_ip | default(hostvars[kubernetes_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
|