Path to ansible.cfg?

Hi,

The docs at 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,
  Grzegorz Nosek

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

Made pull request to fix that.

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

– Michael

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.

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.

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?