summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/node/tasks/main.yml
blob: 1d5178ea93cc60e5f539292888e7775702f89ece (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
- name: join kubernetes node and store log
  block:
  - name: join kubernetes node
    command: "kubeadm join 127.0.0.1:6443 --node-name {{ inventory_hostname }}{% if kubernetes_cri_socket is defined %} --cri-socket {{ kubernetes_cri_socket }}{% endif %} --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