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
145 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+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
19 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,040 points
473 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.