About "has no attribute" error
espala opened this issue · comments
espala commented
Hello,
I am up to 3 instance on gce using terraform. I'm trying to create a kubernetes cluster on these 3 nodes. Until ansible, everything works fine. Servers open, firewall rules, network is complete.
I used the example of allinone. I always get the following error. Where am I making a mistake?
cat inventory
#xxx=public ip adresses
[kubernetes:children]
etcd
k8s_masters
k8s_nodes
[kubernetes:vars]
docker_version="18.06.0-ce"
[etcd]
x.x.x.x ansible_ssh_user=testuser
x.x.x.x ansible_ssh_user=testuser
x.x.x.x ansible_ssh_user=testuser
[k8s_masters]
x.x.x.x ansible_ssh_user=testuser
[k8s_nodes]
x.x.x.x ansible_ssh_user=testuser
x.x.x.x ansible_ssh_user=testuser
cat playbook.yml
- hosts: kubernetes
# sudo: yes
become: true
become_user: root
gather_facts: false
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
changed_when: false
- hosts: kubernetes
# sudo: yes
become: true
become_user: root
roles:
# - geerlingguy.docker
- anmoel.kubernetes
my command;
export ANSIBLE_HOST_KEY_CHECKING=False && time ansible-playbook -i inventory playbook.yml -v
error message;
TASK [anmoel.kubernetes : /etc/kubernetes/kubeadm/clusterconfig.yaml] **********************************************************************************************************************************************************************************************************
fatal: [x.x.x.x]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_host'"}
fatal: [x.x.x.x]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_host'"}
fatal: [x.x.x.x]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_host'"}
to retry, use: --limit @.../playbook.retry
PLAY RECAP *********************************************************************************************************************************************************************************************************************************************************************
x.x.x.x : ok=30 changed=14 unreachable=0 failed=1
x.x.x.x : ok=30 changed=14 unreachable=0 failed=1
x.x.x.x : ok=30 changed=14 unreachable=0 failed=1
Matteo commented
Seems related to this ansible issue: ansible/ansible#51727