diff --git a/kube-cluster/workers.yml b/kube-cluster/workers.yml new file mode 100644 index 0000000..56c5659 --- /dev/null +++ b/kube-cluster/workers.yml @@ -0,0 +1,21 @@ +- hosts: control_plane + become: yes + gather_facts: false + tasks: + - name: get join command + shell: kubeadm token create --print-join-command + register: join_command_raw + + - name: set join command + set_fact: + join_command: "{{ join_command_raw.stdout_lines[0] }}" + + +- hosts: workers + become: yes + tasks: + - name: join cluster + shell: "{{ hostvars['control1'].join_command }} >> node_joined.txt" + args: + chdir: $HOME + creates: node_joined.txt \ No newline at end of file