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:
- it’s a hack and may disappear
- 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)