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
6f2a0c60
Commit
6f2a0c60
authored
Mar 25, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ansible_inventory_basedir' of
git://github.com/stoned/ansible
into test_basedir
Conflicts: lib/ansible/runner/__init__.py
parents
774bf8ab
abe126fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
docsite/rst/playbooks2.rst
+2
-0
lib/ansible/playbook/__init__.py
+5
-2
lib/ansible/playbook/play.py
+5
-2
lib/ansible/runner/__init__.py
+2
-0
No files found.
docsite/rst/playbooks2.rst
View file @
6f2a0c60
...
...
@@ -146,6 +146,8 @@ period, without the rest of the domain.
Don't worry about any of this unless you think you need it. You'll know when you do.
Also available, *inventory_dir* is the pathname of the directory holding Ansible's inventory host file.
Variable File Separation
````````````````````````
...
...
lib/ansible/playbook/__init__.py
View file @
6f2a0c60
...
...
@@ -121,7 +121,10 @@ class PlayBook(object):
self
.
inventory
=
inventory
self
.
basedir
=
os
.
path
.
dirname
(
playbook
)
or
'.'
(
self
.
playbook
,
self
.
play_basedirs
)
=
self
.
_load_playbook_from_file
(
playbook
)
vars
=
{}
if
self
.
inventory
.
basedir
()
is
not
None
:
vars
[
'inventory_dir'
]
=
self
.
inventory
.
basedir
()
(
self
.
playbook
,
self
.
play_basedirs
)
=
self
.
_load_playbook_from_file
(
playbook
,
vars
)
# *****************************************************
...
...
@@ -171,7 +174,7 @@ class PlayBook(object):
for
t
in
tokens
[
1
:]:
(
k
,
v
)
=
t
.
split
(
"="
,
1
)
incvars
[
k
]
=
utils
.
template
(
basedir
,
v
,
incvars
)
included_path
=
utils
.
path_dwim
(
basedir
,
tokens
[
0
]
)
included_path
=
utils
.
path_dwim
(
basedir
,
utils
.
template
(
basedir
,
tokens
[
0
],
incvars
)
)
(
plays
,
basedirs
)
=
self
.
_load_playbook_from_file
(
included_path
,
incvars
)
for
p
in
plays
:
if
'vars'
not
in
p
:
...
...
lib/ansible/playbook/play.py
View file @
6f2a0c60
...
...
@@ -80,8 +80,11 @@ class Play(object):
self
.
_update_vars_files_for_host
(
None
)
self
.
_tasks
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'tasks'
,
[]))
self
.
_handlers
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'handlers'
,
[]))
load_vars
=
{}
if
self
.
playbook
.
inventory
.
basedir
()
is
not
None
:
load_vars
[
'inventory_dir'
]
=
self
.
playbook
.
inventory
.
basedir
();
self
.
_tasks
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'tasks'
,
[]),
load_vars
)
self
.
_handlers
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'handlers'
,
[]),
load_vars
)
if
self
.
tags
is
None
:
self
.
tags
=
[]
...
...
lib/ansible/runner/__init__.py
View file @
6f2a0c60
...
...
@@ -339,6 +339,8 @@ class Runner(object):
inject
[
'groups'
]
=
self
.
inventory
.
groups_list
()
inject
[
'vars'
]
=
self
.
module_vars
inject
[
'environment'
]
=
self
.
environment
if
self
.
inventory
.
basedir
()
is
not
None
:
inject
[
'inventory_dir'
]
=
self
.
inventory
.
basedir
()
# allow with_foo to work in playbooks...
items
=
None
...
...
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