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

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!

You need a group as the second argument. try

ansible -i hosts vm -m ping

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

ansible -i hosts -m ping all

DOH!!! thanks so much! that worked.