--- - hosts: k8s-nodes remote_user: hybris become: yes tasks: - name: initialize kubernetes master shell: kubeadm init --apiserver-advertise-address=2001:470:6d:22c:42::1 --pod-network-cidr=2001:470:6d:22c:42::/80 delegate_to: k8s-master.e2m run_once: yes - shell: kubeadm token create --print-join-command register: results - debug: var: results.stdout - set_fact: k8s_token: "{{ results.stdout | regex_search(regexp, '\\2') | first }}" vars: regexp: '([^\s]+\s){4}([^\s]+)' - debug: var: k8s_token - set_fact: k8s_ca_cert_hash: "{{ results.stdout | regex_search(regexp, '\\2') | first }}" vars: regexp: '([^\s]+\s){6}([^\s]+)' - debug: var: k8s_ca_cert_hash - name: join nodes to cluster shell: kubeadm join [2001:470:6d:22c:42::1]:6443 --token {{ k8s_token }} --discovery-token-ca-cert-hash sha256:{{ k8s_ca_cert_hash }} delegate_to: k8s-nodes