Errors when executing - ansible -m ping all - kubespray

0 votes

I'm trying to provision my kubernetes cluster using kubespray, when I try to execute this command:

$ ansible -m ping all

It gives me these warnings intead of the expected output.

 [WARNING]:  * Failed to parse /etc/ansible/hosts with yaml plugin: YAML

inventory has invalid structure, it should be a dictionary, got: <class

'ansible.parsing.yaml.objects.AnsibleUnicode'>

 [WARNING]:  * Failed to parse /etc/ansible/hosts with ini plugin:

/etc/ansible/hosts:45: Expected key=value host variable assignment, got:

192.168.56.101

 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note

that the implicit localhost does not match 'all'
Jan 23 in Ansible by Ananya
514 views

1 answer to this question.

+1 vote

Hey @Ananya, make sure of these following things:

configured your hosts by adding the hosts in /etc/ansible/hosts file

made the ssh connection 

answered Jan 23 by Yesha
I have done both of them and I still get the error
Also make sure the hosts are present in /etc/hosts file
Yes its present in this format

server <server-ip>

host <host-ip>
Ahhhh that's where you're going wrong.

Add only the host name without the ip and there is no need to add the server ip. Those should be added in your /etc/ansible/hosts
That was great, warnings are gone. Thanks

Related Questions In Ansible

0 votes
2 answers
0 votes
1 answer

Error when executing ansible playbook on Azure

Hey @Ganga, As the error message says, ...READ MORE

answered Jan 28 in Ansible by Kavya
46 views
0 votes
1 answer
0 votes
1 answer

When conditional not working in Ansible

Your identation is wrong and when is ...READ MORE

answered Apr 27, 2018 in Ansible by ajs3033
• 7,280 points
881 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
216 views
0 votes
1 answer
0 votes
1 answer