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

**URL:** <https://forum.ansible.com/t/ansible-cfg-hostfile-not-being-found-trying-to-be-able-to-not-use-i/13481>\
**Category:** Ansible Project\
**Created:** [September 16, 2013, 12:31am UTC](https://forum.ansible.com/t/ansible-cfg-hostfile-not-being-found-trying-to-be-able-to-not-use-i/13481 "2013-09-16T00:31:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skylar\_Saveland](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Skylar\_Saveland](https://forum.ansible.com/u/Skylar_Saveland)\
**Post date:** [September 16, 2013, 12:31am UTC](https://forum.ansible.com/t/ansible-cfg-hostfile-not-being-found-trying-to-be-able-to-not-use-i/13481/1 "2013-09-16T00:31:48Z")

</div>

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](https://github.com/skyl/ansible-sandbox/issues/1)

::

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

But,

```auto
$ 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

```

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [September 16, 2013, 1:30am UTC](https://forum.ansible.com/t/ansible-cfg-hostfile-not-being-found-trying-to-be-able-to-not-use-i/13481/2 "2013-09-16T01:30:56Z")

</div>

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?
