Commit d7f83471 by Michael DeHaan

Merge pull request #1032 from mavimo/patch-2

Add support for ./ansible.cfg file
parents 522a3b59 0cdd081b
...@@ -35,13 +35,16 @@ def get_config(p, section, key, env_var, default): ...@@ -35,13 +35,16 @@ def get_config(p, section, key, env_var, default):
def load_config_file(): def load_config_file():
p = ConfigParser.ConfigParser() p = ConfigParser.ConfigParser()
path1 = os.path.expanduser( path1 = os.getcwd() + "/ansible.cfg"
os.environ.get('ANSIBLE_CONFIG', "~/.ansible.cfg")) path2 = os.path.expanduser(os.environ.get('ANSIBLE_CONFIG', "~/.ansible.cfg"))
path2 = "/etc/ansible/ansible.cfg" path3 = "/etc/ansible/ansible.cfg"
if os.path.exists(path1): if os.path.exists(path1):
p.read(path1) p.read(path1)
elif os.path.exists(path2): elif os.path.exists(path2):
p.read(path2) p.read(path2)
elif os.path.exists(path3):
p.read(path3)
else: else:
return None return None
return p return p
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment