23 lines
493 B
YAML
23 lines
493 B
YAML
- hosts: master
|
|
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['master'].join_command }} >> node_joined.txt"
|
|
args:
|
|
chdir: $HOME
|
|
creates: node_joined.txt
|
|
|