--- - 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