Initial commit

This commit is contained in:
2026-06-17 22:31:40 +01:00
commit 799b19d445
11 changed files with 635 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
- name: Extract Worker Join Token from Primary Master
hosts: masters[0] # <--- Targets only the first master safely
gather_facts: false
tasks:
- name: Generate worker join command
ansible.builtin.command: kubeadm token create --print-join-command
register: join_command_raw
changed_when: false # Reading/generating a token text string changes no host state
- name: Save join command globally
ansible.builtin.set_fact:
k8s_worker_join: "{{ join_command_raw.stdout }}"
delegate_to: localhost
delegate_facts: true
- name: Join Worker Nodes to Cluster
hosts: workers
gather_facts: false
tasks:
- name: Join cluster
ansible.builtin.shell: "{{ hostvars['localhost']['k8s_worker_join'] }} >> node_joined.txt"
args:
chdir: $HOME
creates: node_joined.txt