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
27e86752
Commit
27e86752
authored
Sep 20, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the role_name in the task its own field for use in the callback
parent
7272aa03
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
lib/ansible/playbook/__init__.py
+6
-1
lib/ansible/playbook/play.py
+4
-2
lib/ansible/playbook/task.py
+2
-5
No files found.
lib/ansible/playbook/__init__.py
View file @
27e86752
...
...
@@ -347,7 +347,12 @@ class PlayBook(object):
ansible
.
callbacks
.
set_task
(
self
.
callbacks
,
task
)
ansible
.
callbacks
.
set_task
(
self
.
runner_callbacks
,
task
)
self
.
callbacks
.
on_task_start
(
template
(
play
.
basedir
,
task
.
name
,
task
.
module_vars
,
lookup_fatal
=
False
,
filter_fatal
=
False
),
is_handler
)
if
task
.
role_name
:
name
=
'
%
s|
%
s'
%
(
task
.
role_name
,
task
.
name
)
else
:
name
=
task
.
name
self
.
callbacks
.
on_task_start
(
template
(
play
.
basedir
,
name
,
task
.
module_vars
,
lookup_fatal
=
False
,
filter_fatal
=
False
),
is_handler
)
if
hasattr
(
self
.
callbacks
,
'skip_task'
)
and
self
.
callbacks
.
skip_task
:
ansible
.
callbacks
.
set_task
(
self
.
callbacks
,
None
)
ansible
.
callbacks
.
set_task
(
self
.
runner_callbacks
,
None
)
...
...
lib/ansible/playbook/play.py
View file @
27e86752
...
...
@@ -285,18 +285,20 @@ class Play(object):
if
not
os
.
path
.
isfile
(
task
)
and
not
os
.
path
.
isfile
(
handler
)
and
not
os
.
path
.
isfile
(
vars_file
)
and
not
os
.
path
.
isdir
(
library
):
raise
errors
.
AnsibleError
(
"found role at
%
s, but cannot find
%
s or
%
s or
%
s or
%
s"
%
(
role_path
,
task
,
handler
,
vars_file
,
library
))
if
os
.
path
.
isfile
(
task
):
if
isinstance
(
role
,
dict
):
role_name
=
role
[
'role'
]
else
:
role_name
=
role
if
os
.
path
.
isfile
(
task
):
nt
=
dict
(
include
=
pipes
.
quote
(
task
),
vars
=
role_vars
,
default_vars
=
default_vars
,
role_name
=
role_name
)
for
k
in
special_keys
:
if
k
in
special_vars
:
nt
[
k
]
=
special_vars
[
k
]
new_tasks
.
append
(
nt
)
if
os
.
path
.
isfile
(
handler
):
nt
=
dict
(
include
=
pipes
.
quote
(
handler
),
vars
=
role_vars
)
nt
=
dict
(
include
=
pipes
.
quote
(
handler
),
vars
=
role_vars
,
role_name
=
role_name
)
for
k
in
special_keys
:
if
k
in
special_vars
:
nt
[
k
]
=
special_vars
[
k
]
...
...
lib/ansible/playbook/task.py
View file @
27e86752
...
...
@@ -25,7 +25,7 @@ class Task(object):
__slots__
=
[
'name'
,
'meta'
,
'action'
,
'only_if'
,
'when'
,
'async_seconds'
,
'async_poll_interval'
,
'notify'
,
'module_name'
,
'module_args'
,
'module_vars'
,
'default_vars'
,
'play'
,
'notified_by'
,
'tags'
,
'register'
,
'play'
,
'notified_by'
,
'tags'
,
'register'
,
'role_name'
,
'delegate_to'
,
'first_available_file'
,
'ignore_errors'
,
'local_action'
,
'transport'
,
'sudo'
,
'sudo_user'
,
'sudo_pass'
,
'items_lookup_plugin'
,
'items_lookup_terms'
,
'environment'
,
'args'
,
...
...
@@ -110,6 +110,7 @@ class Task(object):
self
.
register
=
ds
.
get
(
'register'
,
None
)
self
.
sudo
=
utils
.
boolean
(
ds
.
get
(
'sudo'
,
play
.
sudo
))
self
.
environment
=
ds
.
get
(
'environment'
,
{})
self
.
role_name
=
role_name
# rather than simple key=value args on the options line, these represent structured data and the values
# can be hashes and lists, not just scalars
...
...
@@ -159,10 +160,6 @@ class Task(object):
if
self
.
name
is
None
:
self
.
name
=
self
.
action
# prepend the role name this task is from, if there was one
if
role_name
:
self
.
name
=
"
%
s|
%
s"
%
(
role_name
,
self
.
name
)
# load various attributes
self
.
only_if
=
ds
.
get
(
'only_if'
,
'True'
)
self
.
when
=
ds
.
get
(
'when'
,
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