--- - name: Generate Hosts File hosts: leader become: true gather_facts: true vars: nodeip: var=ansible_ens2.ipv4.address tasks: - name: Initializing Kubernetes cluster shell: kubeadm init --control-plane-endpoint "haproxy.fareast.corp.microsoft.com:80" --upload-certs --apiserver-advertise-address {{ansible_ens2.ipv4.address}} --skip-phases=addon/kube-proxy --skip-phases=addon/coredns register: output - name: Storing Logs and Generated token for future purpose. local_action: copy content={{ output.stdout }} dest="./token" - name: Create .kube directory become: yes become_user: isl file: path: $HOME/.kube state: directory mode: 0755 - name: Copy admin.conf to user's kube config copy: src: /etc/kubernetes/admin.conf dest: /home/isl/.kube/config remote_src: yes owner: isl