Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
80ddd1ca
Commit
80ddd1ca
authored
Feb 14, 2014
by
Richard C Isaacson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config resoution order correction and documentation.
parent
bab91f9e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
19 deletions
+29
-19
docsite/rst/intro_configuration.rst
+13
-6
examples/ansible.cfg
+4
-3
lib/ansible/constants.py
+12
-10
No files found.
docsite/rst/intro_configuration.rst
View file @
80ddd1ca
...
...
@@ -5,17 +5,24 @@ The Ansible Configuration File
.. highlight:: bash
Certain
things in Ansible are adjustable in a configuration file. In general, the stock configuration is probably
right for most users, but that doesn't mean you might not
want to change them.
Certain
settings in Ansible are adjustable via a configuration file. The stock configuration should be sufficient
for most users, but there may be reasons you would
want to change them.
The mechanism for doing this is the "ansible.cfg" file, which is looked for in the following locations
::
Changes can be made and used in a configuration file which will be processed processed in the following order
::
* ANSIBLE_CONFIG (an environment variable)
* ansible.cfg (in the current directory)
* .ansible.cfg (in the home directory)
* /etc/ansible/ansible.cfg
* ~/.ansible.cfg
Prior to 1.5 the order was::
* ansible.cfg (in the current directory)
* ANSIBLE_CONFIG (an environment variable)
* .ansible.cfg (in the home directory)
* /etc/ansible/ansible.cfg
If multiple file locations matching the above exist, the last location on the above list is used. Settings in files
are not merged together.
Ansible will process the above list and use the first file found. Settings in file are not merged together.
.. _getting_the_latest_configuration:
...
...
examples/ansible.cfg
View file @
80ddd1ca
...
...
@@ -2,9 +2,10 @@
# ==============================================
# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ~/.ansible.cfg,
# ansible.cfg in the current working directory or
# /etc/ansible/ansible.cfg, whichever it finds first
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first
[defaults]
...
...
lib/ansible/constants.py
View file @
80ddd1ca
...
...
@@ -56,20 +56,22 @@ def _get_config(p, section, key, env_var, default):
return
default
def
load_config_file
():
''' Load Config File order(first found is used): ENV, CWD, HOME, /etc/ansible '''
p
=
ConfigParser
.
ConfigParser
()
path0
=
os
.
getenv
(
"ANSIBLE_CONFIG"
,
None
)
if
path0
is
not
None
:
path0
=
os
.
path
.
expanduser
(
path0
)
path1
=
os
.
getcwd
()
+
"/ansible.cfg"
path2
=
os
.
path
.
expanduser
(
os
.
environ
.
get
(
'ANSIBLE_CONFIG'
,
"~/.ansible.cfg"
)
)
path2
=
os
.
path
.
expanduser
(
"~/.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
for
path
in
[
path0
,
path1
,
path2
,
path3
]:
if
path
is
not
None
and
os
.
path
.
exists
(
path
):
p
.
read
(
path
)
return
p
return
None
def
shell_expand_path
(
path
):
''' shell_expand_path is needed as os.path.expanduser does not work
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment