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 24, 2019 in Ansible by Ananya
4,837 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 24, 2019 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

Ansible error while ansible -m ping all

It looks like ansible may be installed ...READ MORE

answered Mar 18, 2019 in Ansible by Vince
2,820 views
0 votes
1 answer

Error when executing ansible playbook on Azure

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

answered Jan 29, 2019 in Ansible by Kavya
702 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,300 points
5,151 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,460 views
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP