refactor: split control plane role into init/join/copy tasks
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
- name: Generate join command
|
||||
ansible.builtin.command: kubeadm token create --print-join-command --kubeconfig /etc/kubernetes/admin.conf
|
||||
register: kubernetes_control_plane_join_command
|
||||
run_once: true
|
||||
changed_when: false
|
||||
|
||||
- name: Get certificate key
|
||||
ansible.builtin.command: kubeadm init phase upload-certs --upload-certs --kubeconfig /etc/kubernetes/admin.conf
|
||||
register: kubernetes_control_plane_certificate_key
|
||||
run_once: true
|
||||
changed_when: false
|
||||
|
||||
- name: Join additional control planes
|
||||
ansible.builtin.command: >-
|
||||
{{ kubernetes_control_plane_join_command.stdout }}
|
||||
--control-plane
|
||||
--certificate-key
|
||||
{{ kubernetes_control_plane_certificate_key.stdout_lines[-1] }}
|
||||
args:
|
||||
creates: /etc/kubernetes/admin.conf
|
||||
Reference in New Issue
Block a user