blob: 13937bcf3966cd766353e9f9b5dc409ce42313b9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
---
- name: join kubernetes node and store log
block:
- name: join kubernetes node
command: "kubeadm join 127.0.0.1:6443 --node-name {{ inventory_hostname }} --cri-socket {{ kubernetes_cri_socket }} --token '{{ kube_bootstrap_token }}' --discovery-token-ca-cert-hash '{{ kube_bootstrap_ca_cert_hash }}'"
args:
creates: /etc/kubernetes/kubelet.conf
register: kubeadm_join
always:
- name: dump output of kubeadm join to log file
when: kubeadm_join is changed
# This is not a handler by design to make sure this action runs at this point of the play.
copy: # noqa 503
content: "{{ kubeadm_join.stdout }}\n"
dest: /etc/kubernetes/kubeadm-join.log
- name: dump error output of kubeadm join to log file
when: kubeadm_join.changed and kubeadm_join.stderr
copy:
content: "{{ kubeadm_join.stderr }}\n"
dest: /etc/kubernetes/kubeadm-join.errors
|