summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/node/tasks/main.yml
blob: 655b1b185926c87fb3e028bcbf571ce511b0965d (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 %} --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