# Option to allow empty inventory

**URL:** <https://forum.ansible.com/t/option-to-allow-empty-inventory/16988>\
**Category:** Ansible Developer\
**Created:** [December 8, 2014, 6:29pm UTC](https://forum.ansible.com/t/option-to-allow-empty-inventory/16988 "2014-12-08T18:29:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathieu\_Guillaume](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@Mathieu\_Guillaume](https://forum.ansible.com/u/Mathieu_Guillaume)\
**Post date:** [December 8, 2014, 6:29pm UTC](https://forum.ansible.com/t/option-to-allow-empty-inventory/16988/1 "2014-12-08T18:29:04Z")

</div>

I’ve just submitted a pull request (#9748) to add an option to not error out when an inventory file does not define any host.  
At the moment, this triggers an instant “ERROR: provided hosts list is empty” from ansible-playbook.

The use case for this is when hosts are first dynamically detected/provisionned on a local play and added to the inventory with add\_host.

Currently, we can use the “comma hack”, but:

1. it’s a hack and may disappear
2. it does not allow the use of a group\_vars directory at the same level as the inventory file (the comma makes is\_file return false, so no basedir is set, and then no basedir is searched)

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 13, 2015, 4:32am UTC](https://forum.ansible.com/t/option-to-allow-empty-inventory/16988/2 "2015-02-13T04:32:39Z")

</div>

in current devel, empty inventories now give a warning not an error, so this should be possible now
