# Path to ansible.cfg?

**URL:** <https://forum.ansible.com/t/path-to-ansible-cfg/14054>\
**Category:** Ansible Project\
**Created:** [December 3, 2013, 6:58pm UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054 "2013-12-03T18:58:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grzegorz\_Nosek](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@Grzegorz\_Nosek](https://forum.ansible.com/u/Grzegorz_Nosek)\
**Post date:** [December 3, 2013, 6:58pm UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054/1 "2013-12-03T18:58:02Z")

</div>

Hi,

The docs at [http://www.ansibleworks.com/docs/intro\_configuration.html](http://www.ansibleworks.com/docs/intro_configuration.html) say:

The mechanism for doing this is the “ansible.cfg” file, which is looked for in the following locations:

\* /etc/ansible/ansible.cfg  
\* ~/.ansible.cfg  
\* ansible.cfg (in the playbook directory)

However, I noticed that Ansible (v1.4.1) searches for the file in the \_current\_ directory (not the playbook directory). Is this a bug in the docs or am I doing something wrong? I'd like to have a project-wide ansible.cfg file used with certain playbooks regardless of my current working directory.

Best regards,  
&nbsp;&nbsp;Grzegorz Nosek

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 3, 2013, 7:04pm UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054/2 "2013-12-03T19:04:38Z")

</div>

I believe this has already been mentioned in a ticket recently. Perhaps this comment: [https://github.com/ansible/ansible/issues/5115#issuecomment-29583941](https://github.com/ansible/ansible/issues/5115#issuecomment-29583941)

---

<div class="post-metadata">

**Author:** ![anatoly\_techtonik](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@anatoly\_techtonik](https://forum.ansible.com/u/anatoly_techtonik)\
**Post date:** [December 5, 2013, 5:41pm UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054/3 "2013-12-05T17:41:56Z")

</div>

Made pull request to fix that.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 5, 2013, 8:48pm UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054/4 "2013-12-05T20:48:34Z")

</div>

The code behavior should not change here, we just want to clarify docs.

– Michael

---

<div class="post-metadata">

**Author:** ![anatoly\_techtonik](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@anatoly\_techtonik](https://forum.ansible.com/u/anatoly_techtonik)\
**Post date:** [December 6, 2013, 7:22am UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054/5 "2013-12-06T07:22:47Z")

</div>

I am sure the docs are right. Reading ansible.cfg from playbook.yml  
directory is intuitive and valid. It is much better than reading  
playbooks from random dir. I can easily imagine my IDE to be set to  
the wrong working directory with ansible.cfg inside. I'd hate to debug  
this issue.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 6, 2013, 12:55pm UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054/6 "2013-12-06T12:55:56Z")

</div>

I understand your complaint, however, the docs aren’t right because they don’t match the code.

We will not be breaking existing users by changing this.

What you should do of course is put your ansible.cfg in the user specific location or the global location, and not use the other if you do not  
like that behavior.

People keep playbooks in various directories of their repo and it does not make sense.

pb/site.yml  
pb/other/include.yml

And may run them from _both_ places, and in which case the latter would not find ansible.cfg

The code is correct and will not be changing, I’d suggest, again, not using this behavior if you don’t like it.

---

<div class="post-metadata">

**Author:** ![anatoly\_techtonik](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@anatoly\_techtonik](https://forum.ansible.com/u/anatoly_techtonik)\
**Post date:** [December 6, 2013, 3:15pm UTC](https://forum.ansible.com/t/path-to-ansible-cfg/14054/7 "2013-12-06T15:15:37Z")

</div>

> I understand your complaint, however, the docs aren't right because they  
> don't match the code.
> 
> We will not be breaking existing users by changing this.
> 
> What you should do of course is put your ansible.cfg in the user specific  
> location or the global location, and not use the other if you do not  
> like that behavior.
> 
> People keep playbooks in various directories of their repo and it does not  
> make sense.
> 
> pb/site.yml  
> pb/other/include.yml
> 
> And may run them from \*both\* places, and in which case the latter would not  
> find ansible.cfg

Which case are speaking about - current or proposed?

> The code is correct and will not be changing, I'd suggest, again, not using  
> this behavior if you don't like it.

Have you considered my case in addition to existing lookup logic?
