“skipping: no hosts matched” issue with Vagrant and Ansible

Question:

I have installed Vagrant, VirtualBox and Ansible and trying to run provision over one host but it always returns “skipping: no hosts matched”

The head of my playbook file looks like this:

and my /etc/ansible/hosts file looks like this:

I tried putting the IP address there but had the same result. I have added my ssh key to the server and added webserver1 host to both .ssh/config and /etc/hosts.

I can ssh vagrant@webserver1 fine without being prompted for a password, thanks to using the ssh key.

What am I missing here?

  • Host: Debian 7.2
  • Client machine: Debian 7
  • Virtualbox: 4.1.18
  • Vangrantup: 1.4.1
  • Ansible: 1.5

Answer:

It could help to post your Vagrantfile and your ansible inventory file.

  • Are you using the default ansible provider of vagrant?did you specify the inventory_path?

  • Are you launching it the through the a vagrant ssh with --connection=local try a /etc/ansible/hosts

  • Are you using the ansibleLocal provider / vagrant plugin?

Leave a Reply