# SKipping no hosts matched

**URL:** <https://forum.ansible.com/t/skipping-no-hosts-matched/25066>\
**Category:** Ansible Project\
**Created:** [July 24, 2017, 11:47am UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066 "2017-07-24T11:47:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [July 24, 2017, 11:47am UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/1 "2017-07-24T11:47:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 24, 2017, 12:58pm UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/2 "2017-07-24T12:58:39Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [July 25, 2017, 6:58am UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/3 "2017-07-25T06:58:39Z")

</div>

i dont get this, this is not working, how can i make it work? ☹

---

<div class="post-metadata">

**Author:** ![Mike\_Eriksson](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@Mike\_Eriksson](https://forum.ansible.com/u/Mike_Eriksson)\
**Post date:** [July 25, 2017, 7:18am UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/4 "2017-07-25T07:18:43Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 25, 2017, 11:15am UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/5 "2017-07-25T11:15:11Z")

</div>

Set hosts: all in your plays

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [July 25, 2017, 11:26am UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/6 "2017-07-25T11:26:12Z")

</div>

i cannot run a playbook straightaway against a single host without having that in inventory?

---

<div class="post-metadata">

**Author:** ![Mike\_Eriksson](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@Mike\_Eriksson](https://forum.ansible.com/u/Mike_Eriksson)\
**Post date:** [July 25, 2017, 11:33am UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/7 "2017-07-25T11:33:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [July 25, 2017, 1:41pm UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/8 "2017-07-25T13:41:14Z")

</div>

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? ☹

---

<div class="post-metadata">

**Author:** ![Mike\_Eriksson](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@Mike\_Eriksson](https://forum.ansible.com/u/Mike_Eriksson)\
**Post date:** [July 25, 2017, 1:48pm UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/9 "2017-07-25T13:48:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [July 25, 2017, 1:54pm UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/10 "2017-07-25T13:54:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 25, 2017, 2:00pm UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/11 "2017-07-25T14:00:07Z")

</div>

add `-c winrm ` to the command.

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [July 25, 2017, 2:02pm UTC](https://forum.ansible.com/t/skipping-no-hosts-matched/25066/12 "2017-07-25T14:02:31Z")

</div>

got it working, just added all.yml in group\_Vars…wow…awesome…thanks buddy
