# ansible installation: no /etc/ansible/hosts file

**URL:** <https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887>\
**Category:** Ansible Project\
**Created:** [November 29, 2015, 1:27pm UTC](https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887 "2015-11-29T13:27:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_M\_Cheung](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sebastian\_M\_Cheung](https://forum.ansible.com/u/Sebastian_M_Cheung)\
**Post date:** [November 29, 2015, 1:27pm UTC](https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887/1 "2015-11-29T13:27:38Z")

</div>

No file for /etc/ansible/hosts

Where is this file? Instructor opened an automatically generated /etc/ansible/hosts file but there is no such file in Mac OSX after ansible is installed?

Am I supposed to create this file myself or it is automatically generated? as I cannot find it on Mac OSX after

$brew install ansible

as well as

$pip install ansible

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 29, 2015, 4:57pm UTC](https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887/2 "2015-11-29T16:57:44Z")

</div>

You have to create it by yourself as pip and brew didn’t create it. I think you even didn’t have /etc/ansible directory.

---

<div class="post-metadata">

**Author:** ![rup](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@rup](https://forum.ansible.com/u/rup)\
**Post date:** [November 30, 2015, 5:26pm UTC](https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887/3 "2015-11-30T17:26:03Z")

</div>

We don’t bother with the /etc/ansible/hosts file because we installed ansible in a different directory. So we always specify which host file to use in our run. I.e. when in the ansible directory I execute:

ansible-playbook -i \<hosts\_file\> site.yml -vv

---

<div class="post-metadata">

**Author:** ![Steven\_Williams](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Steven\_Williams](https://forum.ansible.com/u/Steven_Williams)\
**Post date:** [September 24, 2020, 8:02pm UTC](https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887/4 "2020-09-24T20:02:38Z")

</div>

What if you want to use another directory for hosts, this is where the ansible.cfg file comes in handy. So where does this file go in MacOSX?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [September 25, 2020, 9:21am UTC](https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887/5 "2020-09-25T09:21:45Z")

</div>

[https://docs.ansible.com/ansible/latest/installation\_guide/intro\_configuration.html#configuration-file](https://docs.ansible.com/ansible/latest/installation_guide/intro_configuration.html#configuration-file)

---

<div class="post-metadata">

**Author:** ![ebcak\_random](https://avatars.discourse-cdn.com/v4/letter/e/85e7bf/32.png) [@ebcak\_random](https://forum.ansible.com/u/ebcak_random)\
**Post date:** [September 26, 2020, 8:55pm UTC](https://forum.ansible.com/t/ansible-installation-no-etc-ansible-hosts-file/19887/6 "2020-09-26T20:55:24Z")

</div>

Referenced here in order at what ansible looks for…personally I never use /etc/ansible/ansible.cfg and tend to use a master one in ~/ or ansible.cfg per project directory which specifies other certain criteria I need for my playbook

[https://docs.ansible.com/ansible/latest/reference\_appendices/config.html#ansible-configuration-settings](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings)

- ANSIBLE\_CONFIG (environment variable if set)

- ansible.cfg (in the current directory)

- ~/.ansible.cfg (in the home directory)

- /etc/ansible/ansible.cfg
