kairen / kubeadm-ansible

Build a Kubernetes cluster using kubeadm via Ansible.
Apache License 2.0
724 stars 379 forks source link

Unable to join nodes #63

Open andyanfieldroad opened 5 years ago

andyanfieldroad commented 5 years ago

Hi,

I get the following error when trying to join nodes to the master:

TASK [kubernetes-node : Join to Kubernetes cluster] **** fatal: [kubernetes-node1.k8s.anfieldroad.int]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'\n\nThe error appears to have been in '/home/praetorian/andy/ansible/roles/kubernetes-node/tasks/join.yml': line 7, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Join to Kubernetes cluster\n ^ here\n"}

cat inventories/infrastructure/group_vars/kubernetes-cluster.yml

file: kubernetes-cluster.yml

master_ip: "{{ hostvars[groups['kubernetes-master'][0]]['ansible_default_ipv4'].address | default(groups['kubernetes-master'][0]) }}"

Is something incorrect here? (apart from the fact my group name is different from your code, this is intentional).