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
d0332a6c
Commit
d0332a6c
authored
Mar 13, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'playbook-step' of
git://github.com/skvidal/ansible
into devel
parents
b87e7c0f
a7a083d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
bin/ansible-playbook
+4
-0
lib/ansible/callbacks.py
+15
-1
lib/ansible/playbook/__init__.py
+3
-1
No files found.
bin/ansible-playbook
View file @
d0332a6c
...
...
@@ -72,6 +72,8 @@ def main(args):
help
=
"do a playbook syntax check on the playbook, do not execute the playbook"
)
parser
.
add_option
(
'--list-tasks'
,
dest
=
'listtasks'
,
action
=
'store_true'
,
help
=
"do list all tasks that would be executed"
)
parser
.
add_option
(
'--step'
,
dest
=
'step'
,
action
=
'store_true'
,
help
=
"one-step-at-a-time: confirm each task before running"
)
options
,
args
=
parser
.
parse_args
(
args
)
...
...
@@ -111,6 +113,8 @@ def main(args):
stats
=
callbacks
.
AggregateStats
()
playbook_cb
=
callbacks
.
PlaybookCallbacks
(
verbose
=
utils
.
VERBOSITY
)
if
options
.
step
:
playbook_cb
.
step
=
options
.
step
runner_cb
=
callbacks
.
PlaybookRunnerCallbacks
(
stats
,
verbose
=
utils
.
VERBOSITY
)
pb
=
ansible
.
playbook
.
PlayBook
(
...
...
lib/ansible/callbacks.py
View file @
d0332a6c
...
...
@@ -464,7 +464,21 @@ class PlaybookCallbacks(object):
msg
=
"TASK: [
%
s]"
%
name
if
is_conditional
:
msg
=
"NOTIFIED: [
%
s]"
%
name
print
banner
(
msg
)
if
hasattr
(
self
,
'step'
)
and
self
.
step
:
resp
=
raw_input
(
'Perform task:
%
s (y/n/c): '
%
name
)
if
resp
.
lower
()
in
[
'y'
,
'yes'
]:
self
.
skip_task
=
False
print
banner
(
msg
)
elif
resp
.
lower
()
in
[
'c'
,
'continue'
]:
self
.
skip_task
=
False
self
.
step
=
False
print
banner
(
msg
)
else
:
self
.
skip_task
=
True
else
:
print
banner
(
msg
)
call_callback_module
(
'playbook_on_task_start'
,
name
,
is_conditional
)
def
on_vars_prompt
(
self
,
varname
,
private
=
True
,
prompt
=
None
,
encrypt
=
None
,
confirm
=
False
,
salt_size
=
None
,
salt
=
None
,
default
=
None
):
...
...
lib/ansible/playbook/__init__.py
View file @
d0332a6c
...
...
@@ -301,7 +301,9 @@ class PlayBook(object):
''' run a single task in the playbook and recursively run any subtasks. '''
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
:
return
True
# load up an appropriate ansible runner to run the task in parallel
results
=
self
.
_run_task_internal
(
task
)
...
...
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