ERROR! Specified hosts options do not match any hosts

4,546 views
Skip to first unread message

Jatin Ganhotra

unread,
Mar 27, 2016, 4:13:18 PM3/27/16
to Ansible Project
Hi,

This is my first take at Ansible and I can't figure out what I am doing wrong. I have 1 vagrant VM host with a static private IP provided for testing purposes on my personal Mac.

› ansible --version
ansible 2.0.1.0
  config file =
  configured module search path = Default w/o overrides

My .yml file looks like this ( borrowed & modified from an Ansible example playbook)- 
---
- hosts: all
  sudo: yes
  gather_facts: no

› cat /etc/ansible/hosts
[postgresVMserver]
192.168.33.10

› ls -la /etc/ansible/hosts
-rw-r--r--  1 root  wheel  34 Mar 27 01:11 /etc/ansible/hosts

When I run the playbook, I get 
› ansible-playbook postgresql.yml
 [WARNING]: provided hosts list is empty, only localhost is available

[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This
feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.

PLAY ***************************************************************************
skipping: no hosts matched

PLAY ***************************************************************************
skipping: no hosts matched

PLAY RECAP *********************************************************************

When I run the following command to list all the hosts, I get - 
› ansible -i hosts --list-hosts all
ERROR! Specified hosts options do not match any hosts

What am I doing wrong? Please let me know if you need more information.

Thanks

rup

unread,
Mar 28, 2016, 4:28:06 PM3/28/16
to Ansible Project
How are you running your playbook?  I.e. what is your command?

Johannes Kastl

unread,
Mar 29, 2016, 3:58:45 AM3/29/16
to ansible...@googlegroups.com
Am 27.03.16 schrieb Jatin Ganhotra:

> This is my first take at Ansible and I can't figure out what I am doing
> wrong. I have 1 vagrant VM host with a static private IP provided for
> testing purposes on my personal Mac.

You mean you have a mac as controller host and a VM provided by
Vagrant as the target you want to apply your configuration on?

> My .yml file looks like this ( borrowed & modified from an Ansible example
> playbook)-
> ---
> - hosts: all
> sudo: yes
> gather_facts: no

You have no tasks defined in your playbook.

> › cat /etc/ansible/hosts
> [postgresVMserver]
> 192.168.33.10

> When I run the playbook, I get
> › ansible-playbook postgresql.yml
> [WARNING]: provided hosts list is empty, only localhost is available

Is postgresql.yml the playbook you cited above?

> When I run the following command to list all the hosts, I get -
> › ansible -i hosts --list-hosts all
> ERROR! Specified hosts options do not match any hosts

What happens when you enter the following commands in a shell:

ansible -m setup all

Maybe add a "-vv" before the -m to see errors better.


Regards,
Johannes

signature.asc
Reply all
Reply to author
Forward
0 new messages