Snowcrash
Snowcrash

Reputation: 86317

ansible-playbook: ERROR: provided hosts list is empty

When I run ansible-playbook web_db.yaml I get

ERROR: provided hosts list is empty

Any idea why?

Some additional information:

$ ls -l
-rw-r--r-- 1 vagrant vagrant 100 Aug  4 14:55 ansible.cfg
-rw-rw-r-- 1 vagrant vagrant 222 Oct 20  2016 inventory
-rw-rw-r-- 1 vagrant vagrant 531 May  3 11:58 web_db.yaml

$ pwd
/home/vagrant/exercise1/production

$ cat inventory 
web1 ansible_ssh_host=192.168.33.20
[webservers]
web1

$ cat ansible.cfg 
[defaults]

inventory      = /home/vagrant/exercise1/production/inventory
host_key_checking = False

$ ansible --version
ansible 1.5.4

$ cat web_db.yaml 
---
- hosts: webservers
  sudo: yes

Upvotes: 1

Views: 3399

Answers (1)

Konstantin Suvorov
Konstantin Suvorov

Reputation: 68319

As far as I remember, that ancient Ansible versions used hostfile parameter instead of inventory.

Try with

hostfile = /home/vagrant/exercise1/production/inventory

in your config.

Upvotes: 2

Related Questions