# ansible.cfg overrides

**URL:** <https://forum.ansible.com/t/ansible-cfg-overrides/21345>\
**Category:** Ansible Developer\
**Created:** [May 3, 2016, 7:41pm UTC](https://forum.ansible.com/t/ansible-cfg-overrides/21345 "2016-05-03T19:41:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dusan\_Matejka](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@Dusan\_Matejka](https://forum.ansible.com/u/Dusan_Matejka)\
**Post date:** [May 3, 2016, 7:41pm UTC](https://forum.ansible.com/t/ansible-cfg-overrides/21345/1 "2016-05-03T19:41:08Z")

</div>

Hello,

We are using multiple ansible playbook repositories in our company. While we want to make some configuration directives local only for a specific repository, there are some which need to be defined for every current and future repo used in our setup.

A fine example is a log\_path directive. Let’s say that we want to log every future ansible command run on a master machine to a /var/log/ansible.log which is independent of the repository from which the run was made. This is why I added the following lines to /etc/ansible/ansible.cfg:  
[defaults]  
log\_path = /var/log/ansible.log

However, all directives defined in this file are being ignored, when ${PWD}/ansible.cfg configuration file is present.

I’ve prepared a small patch to deal with this issue: [https://github.com/D3DeFi/ansible/commit/09973901057084f6d06f989ff9b2915a8390e57c](https://github.com/D3DeFi/ansible/commit/09973901057084f6d06f989ff9b2915a8390e57c) but I am not sure if it is a good idea to submit it as a feature\_request or bugfix, or if to submit it at all. Bugfix, because this ‘override’ behavior is standard for many other tools and I think it should be default for ansible as well.

Can you guys please provide your opinion on this ? 🙂 Is this even a good idea or does ansible read only one ansible.cfg file for purpose ?

Thanks,  
Dusan

---

<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:** [May 3, 2016, 7:58pm UTC](https://forum.ansible.com/t/ansible-cfg-overrides/21345/2 "2016-05-03T19:58:33Z")

</div>

It is specifically documented that ansible.cfg files are not merged in the documentation provided at [http://docs.ansible.com/ansible/intro\_configuration.html](http://docs.ansible.com/ansible/intro_configuration.html)

“Ansible will process the above list and use the first file found. Settings in files are not merged”

You could override these values however using env vars. Such as exporting `ANSIBLE_LOG_PATH="/var/log/ansible.log"` before running your ansible command. This could also be achieved by having a file that you source before running ansible.

Having the configurations merge would like cause issues for a number of people. Such as where I have an ~/.ansible.cfg but for some projects I have a completely different ansible.cfg that may not override all of the settings, but I wouldn’t want them merged.

---

<div class="post-metadata">

**Author:** ![Dusan\_Matejka](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@Dusan\_Matejka](https://forum.ansible.com/u/Dusan_Matejka)\
**Post date:** [May 3, 2016, 8:15pm UTC](https://forum.ansible.com/t/ansible-cfg-overrides/21345/3 "2016-05-03T20:15:15Z")

</div>

Thank you for explaining this to me Matt 🙂 I somehow managed to overlook line you pointed out.
