aboutsummaryrefslogtreecommitdiffstats
path: root/tools/k8s/cluster-deployment/k8scluster/roles/clustermanager/tasks/workers.yml
blob: a0a815c4cda6ccd2a63b80c88846ed8fc8216865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
- name: check node is already in cluster
  delegate_to: "{{ groups.master[0] }}"
  command: "kubectl get nodes -n kube-system -o name"
  register: get_node_register
  changed_when: false

- name: get join command
  delegate_to: "{{ groups.master[0] }}"
  command: kubeadm token create --print-join-command
  register: join_command_raw

- name: join cluster
  shell: "sudo {{ join_command_raw.stdout_lines[0] }} --ignore-preflight-errors=all > $HOME/node_joined.txt"
  when: ( 'node/' + ansible_hostname ) not in get_node_register.stdout_lines