22 lines
544 B
YAML
22 lines
544 B
YAML
---
|
|
- name: Join workers to Kubernetes cluster
|
|
hosts: workers
|
|
become: true
|
|
|
|
tasks:
|
|
- name: Check if already joined
|
|
stat:
|
|
path: /etc/kubernetes/kubelet.conf
|
|
register: kubelet_conf
|
|
|
|
- name: Read join command from local file
|
|
local_action:
|
|
module: slurp
|
|
src: /tmp/k8s_join_command.sh
|
|
register: join_command_b64
|
|
when: not kubelet_conf.stat.exists
|
|
|
|
- name: Join cluster
|
|
command: "{{ join_command_b64.content | b64decode | trim }}"
|
|
when: not kubelet_conf.stat.exists
|