ansible.cfg hostfile not being found, trying to be able to not use -i

This has to be one of the lowliest questions ever asked here. Apologies for that.

But, I can’t get the ansible.cfg hostfile parameter to work so that I don’t have to specify -i.

The problem can be reproduced here:

https://github.com/skyl/ansible-sandbox/issues/1

::

ansible local -a "ls /" -i HOSTS works

But,

$ ansible local -a "ls /"
ERROR: Unable to find an inventory file, specify one with -i ?
$ cat ansible.cfg
[defaults]
hostfile = ./HOSTS
$ cat HOSTS
[local]
127.0.0.1

Do you have ANSIBLE_HOSTS exported anywhere in your environment? And does the same thing happen if you use a full path rather than a relative path?