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
ed9f5eed
Commit
ed9f5eed
authored
Oct 20, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1338 from alopropoz/extra_vars_override
Vars specified via CLI have the highest priority.
parents
5bdc1633
c5469f63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
docsite/rst/playbooks2.rst
+8
-6
lib/ansible/playbook/play.py
+2
-3
No files found.
docsite/rst/playbooks2.rst
View file @
ed9f5eed
...
@@ -656,17 +656,19 @@ You have already learned about inventory host and group variables, 'vars', and '
...
@@ -656,17 +656,19 @@ You have already learned about inventory host and group variables, 'vars', and '
If a variable name is defined in more than one place with the same name, priority is as follows
If a variable name is defined in more than one place with the same name, priority is as follows
to determine which place sets the value of the variable.
to determine which place sets the value of the variable.
1. Variables
loaded from YAML files mentioned in 'vars_files' in a playbook
.
1. Variables
specified via command line with --extra-vars
.
2.
'vars' as defined in the
playbook.
2.
Variables loaded from YAML files mentioned in 'vars_files' in a
playbook.
3.
facts, whether built in or custom, or variables assigned from the 'register' keyword
.
3.
'vars' as defined in the playbook
.
4.
variables passed to parameterized task include statements
.
4.
facts, whether built in or custom, or variables assigned from the 'register' keyword
.
5.
Host variables from inventory
.
5.
variables passed to parameterized task include statements
.
6. Group variables from inventory, in order of least specific group to most specific.
6. Host variables from inventory.
7. Group variables from inventory, in order of least specific group to most specific.
Therefore, if you want to set a default value for something you wish to override somewhere else, the best
Therefore, if you want to set a default value for something you wish to override somewhere else, the best
place to set such a default is in a group variable.
place to set such a default is in a group variable.
...
...
lib/ansible/playbook/play.py
View file @
ed9f5eed
...
@@ -189,9 +189,8 @@ class Play(object):
...
@@ -189,9 +189,8 @@ class Play(object):
else
:
else
:
raise
errors
.
AnsibleError
(
"'vars_prompt' section is malformed, see docs"
)
raise
errors
.
AnsibleError
(
"'vars_prompt' section is malformed, see docs"
)
results
=
self
.
playbook
.
extra_vars
.
copy
()
vars
.
update
(
self
.
playbook
.
extra_vars
)
results
.
update
(
vars
)
return
vars
return
results
# *************************************************
# *************************************************
...
...
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