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
968c56d7
Commit
968c56d7
authored
Nov 25, 2014
by
James Cammarata
Committed by
Toshio Kuratomi
Nov 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand playbook_dir in time for loading tasks
Fixes #9618
parent
9a77aefc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
lib/ansible/playbook/play.py
+9
-6
No files found.
lib/ansible/playbook/play.py
View file @
968c56d7
...
@@ -79,17 +79,21 @@ class Play(object):
...
@@ -79,17 +79,21 @@ class Play(object):
elif
type
(
self
.
tags
)
!=
list
:
elif
type
(
self
.
tags
)
!=
list
:
self
.
tags
=
[]
self
.
tags
=
[]
# make sure we have some special internal variables set
# make sure we have some special internal variables set, which
self
.
vars
[
'playbook_dir'
]
=
os
.
path
.
abspath
(
self
.
basedir
)
# we use later when loading tasks and handlers
load_vars
=
dict
()
load_vars
[
'playbook_dir'
]
=
os
.
path
.
abspath
(
self
.
basedir
)
if
self
.
playbook
.
inventory
.
basedir
()
is
not
None
:
if
self
.
playbook
.
inventory
.
basedir
()
is
not
None
:
self
.
vars
[
'inventory_dir'
]
=
self
.
playbook
.
inventory
.
basedir
()
load_
vars
[
'inventory_dir'
]
=
self
.
playbook
.
inventory
.
basedir
()
if
self
.
playbook
.
inventory
.
src
()
is
not
None
:
if
self
.
playbook
.
inventory
.
src
()
is
not
None
:
self
.
vars
[
'inventory_file'
]
=
self
.
playbook
.
inventory
.
src
()
load_
vars
[
'inventory_file'
]
=
self
.
playbook
.
inventory
.
src
()
# template the play vars with themselves and the extra vars
# template the play vars with themselves and the extra vars
# from the playbook, to make sure they're correct
# from the playbook, to make sure they're correct
all_vars
=
utils
.
combine_vars
(
self
.
vars
,
self
.
playbook
.
extra_vars
)
all_vars
=
utils
.
combine_vars
(
self
.
vars
,
self
.
playbook
.
extra_vars
)
all_vars
=
utils
.
combine_vars
(
all_vars
,
load_vars
)
self
.
vars
=
template
(
basedir
,
self
.
vars
,
all_vars
)
self
.
vars
=
template
(
basedir
,
self
.
vars
,
all_vars
)
self
.
vars
=
utils
.
combine_vars
(
self
.
vars
,
load_vars
)
# We first load the vars files from the datastructure
# We first load the vars files from the datastructure
# so we have the default variables to pass into the roles
# so we have the default variables to pass into the roles
...
@@ -157,8 +161,7 @@ class Play(object):
...
@@ -157,8 +161,7 @@ class Play(object):
raise
errors
.
AnsibleError
(
'sudo params ("sudo", "sudo_user") and su params '
raise
errors
.
AnsibleError
(
'sudo params ("sudo", "sudo_user") and su params '
'("su", "su_user") cannot be used together'
)
'("su", "su_user") cannot be used together'
)
load_vars
=
{}
load_vars
[
'role_names'
]
=
ds
.
get
(
'role_names'
,
[])
load_vars
[
'role_names'
]
=
ds
.
get
(
'role_names'
,[])
self
.
_tasks
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'tasks'
,
[]),
load_vars
)
self
.
_tasks
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'tasks'
,
[]),
load_vars
)
self
.
_handlers
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'handlers'
,
[]),
load_vars
)
self
.
_handlers
=
self
.
_load_tasks
(
self
.
_ds
.
get
(
'handlers'
,
[]),
load_vars
)
...
...
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