Here's the code that describes the behavior:
def load_config_file():
p = ConfigParser.ConfigParser()
path1 = os.getcwd() + "/ansible.cfg"
path2 = os.path.expanduser(os.environ.get('ANSIBLE_CONFIG',
"~/.ansible.cfg"))
path3 = "/etc/ansible/ansible.cfg"
if os.path.exists(path1):
p.read(path1)
elif os.path.exists(path2):
p.read(path2)
elif os.path.exists(path3):
p.read(path3)
else:
return None
return p
On Mon, Jan 20, 2014 at 4:44 PM, Steve Pereira <[email protected]>wrote:
> Hi Michael,
>
> Huge fan, long time listener, first time caller blah blah
>
> My use case requires a relative path in a local ansible.cfg - I want to
> include it with my checkout (which could be put anywhere) and I'd really
> rather not have to -i or tell others to.
>
> In my case, it seems my config file is actually ignored. I've set relative
> and absolute paths for hostfile, verified I'm using [defaults] and not
> [default], unset ANSIBLE_HOSTS (which I have set for global use) but it
> never seems to be observed. I'd really like to see -vvvv echo the hostfile
> and inventory file Ansible is using (so I could easily verify) but I can
> tell my hosts are not being used regardless.
>
> Is there any known issue with local config files? I'm on an OSX machine,
> Ansible 1.4.2 installed via homebrew (please don't say this is the problem,
> I love homebrew)
>
> Cheers,
>
> - Steve
>
>
> On Friday, December 6, 2013 7:51:20 AM UTC-5, Michael DeHaan wrote:
>
>> Should your inventory file be changing every time you can just specify it
>> with -i.
>>
>>
>> On Fri, Dec 6, 2013 at 2:13 AM, anatoly techtonik <[email protected]>wrote:
>>
>>> This needs some discussion not in tracker
>>> https://github.com/ansible/ansible/issues/5185
>>>
>>> When you create ansible.cfg with the following content:
>>>
>>> [defaults]
>>> hostfile = ./hosts
>>>
>>> What kind of lookup will be more useful?
>>>
>>> 1. From current directory you're in?
>>> 2. From directory of ansible.cfg?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Michael DeHaan <[email protected]>
>>
>> CTO, AnsibleWorks, Inc.
>> http://www.ansibleworks.com/
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
Michael DeHaan <[email protected]>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.