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
42b0e512
Commit
42b0e512
authored
Mar 25, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade callbacks further, now '.play', '.task', and so on are also available!
parent
5b845510
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
CHANGELOG.md
+1
-1
lib/ansible/playbook/__init__.py
+10
-0
No files found.
CHANGELOG.md
View file @
42b0e512
...
@@ -69,7 +69,7 @@ Bugfixes and Misc Changes:
...
@@ -69,7 +69,7 @@ Bugfixes and Misc Changes:
*
'magic' variable 'inventory_basedir' now gives path to inventory file
*
'magic' variable 'inventory_basedir' now gives path to inventory file
*
'magic' variable 'vars' works like 'hostvars' but gives global scope variables, useful for debugging in templates mostly
*
'magic' variable 'vars' works like 'hostvars' but gives global scope variables, useful for debugging in templates mostly
*
conditionals can be used on plugins like add_host
*
conditionals can be used on plugins like add_host
*
all callbacks now have access to a ".runner" and ".playbook" object (.playbook is only set by ansible-playbook
)
*
developers: all callbacks now have access to a ".runner" and ".playbook", ".play", and ".task" object (use getattr, they may not always be set!
)
Facts:
Facts:
...
...
lib/ansible/playbook/__init__.py
View file @
42b0e512
...
@@ -206,6 +206,10 @@ class PlayBook(object):
...
@@ -206,6 +206,10 @@ class PlayBook(object):
self
.
callbacks
.
on_start
()
self
.
callbacks
.
on_start
()
for
(
play_ds
,
play_basedir
)
in
zip
(
self
.
playbook
,
self
.
play_basedirs
):
for
(
play_ds
,
play_basedir
)
in
zip
(
self
.
playbook
,
self
.
play_basedirs
):
play
=
Play
(
self
,
play_ds
,
play_basedir
)
play
=
Play
(
self
,
play_ds
,
play_basedir
)
self
.
callbacks
.
play
=
play
self
.
runner_callbacks
.
play
=
play
matched_tags
,
unmatched_tags
=
play
.
compare_tags
(
self
.
only_tags
)
matched_tags
,
unmatched_tags
=
play
.
compare_tags
(
self
.
only_tags
)
matched_tags_all
=
matched_tags_all
|
matched_tags
matched_tags_all
=
matched_tags_all
|
matched_tags
unmatched_tags_all
=
unmatched_tags_all
|
unmatched_tags
unmatched_tags_all
=
unmatched_tags_all
|
unmatched_tags
...
@@ -306,6 +310,9 @@ class PlayBook(object):
...
@@ -306,6 +310,9 @@ class PlayBook(object):
def
_run_task
(
self
,
play
,
task
,
is_handler
):
def
_run_task
(
self
,
play
,
task
,
is_handler
):
''' run a single task in the playbook and recursively run any subtasks. '''
''' run a single task in the playbook and recursively run any subtasks. '''
self
.
callbacks
.
task
=
task
self
.
runner_callbacks
.
task
=
task
self
.
callbacks
.
on_task_start
(
utils
.
template
(
play
.
basedir
,
task
.
name
,
task
.
module_vars
,
lookup_fatal
=
False
),
is_handler
)
self
.
callbacks
.
on_task_start
(
utils
.
template
(
play
.
basedir
,
task
.
name
,
task
.
module_vars
,
lookup_fatal
=
False
),
is_handler
)
if
hasattr
(
self
.
callbacks
,
'skip_task'
)
and
self
.
callbacks
.
skip_task
:
if
hasattr
(
self
.
callbacks
,
'skip_task'
)
and
self
.
callbacks
.
skip_task
:
return
True
return
True
...
@@ -380,6 +387,9 @@ class PlayBook(object):
...
@@ -380,6 +387,9 @@ class PlayBook(object):
self
.
callbacks
.
on_setup
()
self
.
callbacks
.
on_setup
()
self
.
inventory
.
restrict_to
(
host_list
)
self
.
inventory
.
restrict_to
(
host_list
)
self
.
callbacks
.
task
=
None
self
.
runner_callbacks
.
task
=
None
# push any variables down to the system
# push any variables down to the system
setup_results
=
ansible
.
runner
.
Runner
(
setup_results
=
ansible
.
runner
.
Runner
(
pattern
=
play
.
hosts
,
module_name
=
'setup'
,
module_args
=
{},
inventory
=
self
.
inventory
,
pattern
=
play
.
hosts
,
module_name
=
'setup'
,
module_args
=
{},
inventory
=
self
.
inventory
,
...
...
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