SKipping no hosts matched

1,466 views
Skip to first unread message

Suporter

unread,
Jul 24, 2017, 7:47:27 AM7/24/17
to Ansible Project
Hello,
      i ran this
ansible-playbook setup.yml -i '10.22.212.184,'  and i got the error message as no hosts matched, the ip i gave should be entered somewhere else as inventory file as well?

Brian Coca

unread,
Jul 24, 2017, 8:58:54 AM7/24/17
to Ansible Project
No, that is enough to add to inventory, but it won't add it to
specific groups which your plays might be targeting (`hosts:`
keyword).



--
----------
Brian Coca

Suporter

unread,
Jul 25, 2017, 2:58:39 AM7/25/17
to Ansible Project
i dont get this, this is not working, how can i make it work? :(

Brian Coca

unread,
Jul 25, 2017, 7:21:44 AM7/25/17
to Ansible Project
Set hosts: all in your plays

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6df915d5-72f6-4c1b-b857-f7bac5630e1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Eriksson

unread,
Jul 25, 2017, 7:21:44 AM7/25/17
to Ansible Project
When you use -i you are pointing Ansible to a inventory file. In your case that inventory file is named as '10.22.212.184,'  - does a file with that name exist at all?

If I try to replicate your setup, pointing to an IP address with -i without a corresponding inventory file with that name, I not only get the 'no hosts matched' error I also get the following:

<- Cut ->
 [WARNING]: Host file not found: 192.168.56.11
 [WARNING]: provided hosts list is empty, only localhost is available
<- Cut ->

Do you also see the above when you run it in your end?

There are some info about how to create your inventory file(s) here: http://docs.ansible.com/ansible/latest/intro_inventory.html That could be worth having a look at in order to troubleshoot this further.

Cheers, Mike

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Suporter

unread,
Jul 25, 2017, 7:26:12 AM7/25/17
to Ansible Project
i cannot run a playbook straightaway against a single host without having that in inventory?


On Monday, July 24, 2017 at 5:17:27 PM UTC+5:30, Suporter wrote:

Mike Eriksson

unread,
Jul 25, 2017, 7:33:59 AM7/25/17
to Ansible Project
You can run it with a single host like: "ansible-playbook -i <hostname/ip>, playbookname.yml"

But for it not to complain you must have the statement  'hosts: all' in your playbook.

Cheers, Mike

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Suporter

unread,
Jul 25, 2017, 9:41:14 AM7/25/17
to Ansible Project
wow, good, its runnning but now throwing a weird error ""Failed to connect to the host via ssh: ssh: connect to host " Why does it take ssh why it is not using winrm? :(


On Monday, July 24, 2017 at 5:17:27 PM UTC+5:30, Suporter wrote:

Mike Eriksson

unread,
Jul 25, 2017, 9:48:24 AM7/25/17
to Ansible Project
I believe that ssh is default for Ansible unless otherwise stated. Have you defined that it should use winrm as the connection method for this host anywhere?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Suporter

unread,
Jul 25, 2017, 9:54:25 AM7/25/17
to Ansible Project
nope, this IP has no entry anywhere:( i am kind of confused, usually group_vars folder has entry for group that we mention in hosts:web , but this time its all, how can i do this? should i have any entry in ansible.cfg


On Monday, July 24, 2017 at 5:17:27 PM UTC+5:30, Suporter wrote:

Brian Coca

unread,
Jul 25, 2017, 10:00:25 AM7/25/17
to Ansible Project
add `-c winrm ` to the command.


--
----------
Brian Coca

Suporter

unread,
Jul 25, 2017, 10:02:31 AM7/25/17
to Ansible Project
got it working, just added all.yml in group_Vars...wow..awesome..thanks buddy


On Monday, July 24, 2017 at 5:17:27 PM UTC+5:30, Suporter wrote:
Reply all
Reply to author
Forward
0 new messages