# \[WARNING\]: provided hosts list is empty, only localhost is available

**URL:** <https://forum.ansible.com/t/warning-provided-hosts-list-is-empty-only-localhost-is-available/20953>\
**Category:** Ansible Project\
**Created:** [March 22, 2016, 2:33pm UTC](https://forum.ansible.com/t/warning-provided-hosts-list-is-empty-only-localhost-is-available/20953 "2016-03-22T14:33:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leroy\_Walker\_Jr](https://avatars.discourse-cdn.com/v4/letter/l/c67d28/32.png) [@Leroy\_Walker\_Jr](https://forum.ansible.com/u/Leroy_Walker_Jr)\
**Post date:** [March 22, 2016, 2:33pm UTC](https://forum.ansible.com/t/warning-provided-hosts-list-is-empty-only-localhost-is-available/20953/1 "2016-03-22T14:33:34Z")

</div>

I could really use some help on this issue. I have a hosts file with one server.  
the hosts looks like

**[vm]**  
**172.20.20.106**

when i run the host command, i get:

**ansible -i hosts --list-hosts all**  
**hosts (1):**  
**172.20.20.106**

but when i run a simple ping command

**ansible hosts -m ping**  
**[WARNING]: provided hosts list is empty, only localhost is available**

I get the following

I have not idea whats wrong!

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [March 22, 2016, 4:02pm UTC](https://forum.ansible.com/t/warning-provided-hosts-list-is-empty-only-localhost-is-available/20953/2 "2016-03-22T16:02:09Z")

</div>

You need a group as the second argument. try

ansible -i hosts vm -m ping

---

<div class="post-metadata">

**Author:** ![Uditha\_Desilva](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@Uditha\_Desilva](https://forum.ansible.com/u/Uditha_Desilva)\
**Post date:** [March 22, 2016, 4:20pm UTC](https://forum.ansible.com/t/warning-provided-hosts-list-is-empty-only-localhost-is-available/20953/3 "2016-03-22T16:20:41Z")

</div>

You didn’t specify the inventory in the 2nd command… try

**ansible -i hosts -m ping all**

---

<div class="post-metadata">

**Author:** ![Leroy\_Walker\_Jr](https://avatars.discourse-cdn.com/v4/letter/l/c67d28/32.png) [@Leroy\_Walker\_Jr](https://forum.ansible.com/u/Leroy_Walker_Jr)\
**Post date:** [March 22, 2016, 5:26pm UTC](https://forum.ansible.com/t/warning-provided-hosts-list-is-empty-only-localhost-is-available/20953/4 "2016-03-22T17:26:01Z")

</div>

DOH!!! thanks so much! that worked.
