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
3ab0ed5f
Commit
3ab0ed5f
authored
Apr 12, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow 'when' and 'with_items' to be applied to roles.
parent
7a2d493e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
examples/playbooks/roles/foo/handlers/main.yml
+1
-1
lib/ansible/playbook/play.py
+15
-2
No files found.
examples/playbooks/roles/foo/handlers/main.yml
View file @
3ab0ed5f
...
@@ -6,5 +6,5 @@
...
@@ -6,5 +6,5 @@
# within a role, it's possible to include other task files as well. By default, we
# within a role, it's possible to include other task files as well. By default, we
# can reference files in the same directory without doing anything special:
# can reference files in the same directory without doing anything special:
-
include
:
other.yml
#
- include: other.yml
lib/ansible/playbook/play.py
View file @
3ab0ed5f
...
@@ -140,6 +140,9 @@ class Play(object):
...
@@ -140,6 +140,9 @@ class Play(object):
has_dict
=
orig_path
has_dict
=
orig_path
orig_path
=
role_name
orig_path
=
role_name
with_items
=
has_dict
.
get
(
'with_items'
,
None
)
when
=
has_dict
.
get
(
'when'
,
None
)
path
=
utils
.
path_dwim
(
self
.
basedir
,
orig_path
)
path
=
utils
.
path_dwim
(
self
.
basedir
,
orig_path
)
if
not
os
.
path
.
isdir
(
path
)
and
not
orig_path
.
startswith
(
"."
)
and
not
orig_path
.
startswith
(
"/"
):
if
not
os
.
path
.
isdir
(
path
)
and
not
orig_path
.
startswith
(
"."
)
and
not
orig_path
.
startswith
(
"/"
):
path2
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
'roles'
,
orig_path
))
path2
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
'roles'
,
orig_path
))
...
@@ -152,9 +155,19 @@ class Play(object):
...
@@ -152,9 +155,19 @@ class Play(object):
handler
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'handlers'
,
'main.yml'
))
handler
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'handlers'
,
'main.yml'
))
vars_file
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'vars'
,
'main.yml'
))
vars_file
=
utils
.
path_dwim
(
self
.
basedir
,
os
.
path
.
join
(
path
,
'vars'
,
'main.yml'
))
if
os
.
path
.
isfile
(
task
):
if
os
.
path
.
isfile
(
task
):
new_tasks
.
append
(
dict
(
include
=
task
,
vars
=
has_dict
))
nt
=
dict
(
include
=
task
,
vars
=
has_dict
)
if
when
:
nt
[
'when'
]
=
when
if
with_items
:
nt
[
'with_items'
]
=
with_items
new_tasks
.
append
(
nt
)
if
os
.
path
.
isfile
(
handler
):
if
os
.
path
.
isfile
(
handler
):
new_handlers
.
append
(
dict
(
include
=
handler
,
vars
=
has_dict
))
nt
=
dict
(
include
=
handler
,
vars
=
has_dict
)
if
when
:
nt
[
'when'
]
=
when
if
with_items
:
nt
[
'with_items'
]
=
with_items
new_handlers
.
append
(
nt
)
if
os
.
path
.
isfile
(
vars_file
):
if
os
.
path
.
isfile
(
vars_file
):
new_vars_files
.
append
(
vars_file
)
new_vars_files
.
append
(
vars_file
)
...
...
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