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
690738ea
Commit
690738ea
authored
Apr 09, 2013
by
Seth Vidal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement --start-at-task option to hop to a specific task before starting running them
parent
586ee923
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
bin/ansible-playbook
+4
-0
lib/ansible/callbacks.py
+10
-2
No files found.
bin/ansible-playbook
View file @
690738ea
...
@@ -74,6 +74,8 @@ def main(args):
...
@@ -74,6 +74,8 @@ def main(args):
help
=
"do list all tasks that would be executed"
)
help
=
"do list all tasks that would be executed"
)
parser
.
add_option
(
'--step'
,
dest
=
'step'
,
action
=
'store_true'
,
parser
.
add_option
(
'--step'
,
dest
=
'step'
,
action
=
'store_true'
,
help
=
"one-step-at-a-time: confirm each task before running"
)
help
=
"one-step-at-a-time: confirm each task before running"
)
parser
.
add_option
(
'--start-at-task'
,
dest
=
'start_at'
,
help
=
"start the playbook with a task matching this name"
)
options
,
args
=
parser
.
parse_args
(
args
)
options
,
args
=
parser
.
parse_args
(
args
)
...
@@ -115,6 +117,8 @@ def main(args):
...
@@ -115,6 +117,8 @@ def main(args):
playbook_cb
=
callbacks
.
PlaybookCallbacks
(
verbose
=
utils
.
VERBOSITY
)
playbook_cb
=
callbacks
.
PlaybookCallbacks
(
verbose
=
utils
.
VERBOSITY
)
if
options
.
step
:
if
options
.
step
:
playbook_cb
.
step
=
options
.
step
playbook_cb
.
step
=
options
.
step
if
options
.
start_at
:
playbook_cb
.
start_at
=
options
.
start_at
runner_cb
=
callbacks
.
PlaybookRunnerCallbacks
(
stats
,
verbose
=
utils
.
VERBOSITY
)
runner_cb
=
callbacks
.
PlaybookRunnerCallbacks
(
stats
,
verbose
=
utils
.
VERBOSITY
)
pb
=
ansible
.
playbook
.
PlayBook
(
pb
=
ansible
.
playbook
.
PlayBook
(
...
...
lib/ansible/callbacks.py
View file @
690738ea
...
@@ -21,6 +21,7 @@ import getpass
...
@@ -21,6 +21,7 @@ import getpass
import
os
import
os
import
subprocess
import
subprocess
import
random
import
random
import
fnmatch
from
ansible.color
import
stringc
from
ansible.color
import
stringc
cowsay
=
None
cowsay
=
None
...
@@ -460,8 +461,15 @@ class PlaybookCallbacks(object):
...
@@ -460,8 +461,15 @@ class PlaybookCallbacks(object):
msg
=
"TASK: [
%
s]"
%
name
msg
=
"TASK: [
%
s]"
%
name
if
is_conditional
:
if
is_conditional
:
msg
=
"NOTIFIED: [
%
s]"
%
name
msg
=
"NOTIFIED: [
%
s]"
%
name
if
hasattr
(
self
,
'step'
)
and
self
.
step
:
if
hasattr
(
self
,
'start_at'
):
if
name
==
self
.
start_at
or
fnmatch
.
fnmatch
(
name
,
self
.
start_at
):
# we found out match, we can get rid of this now
del
self
.
start_at
if
hasattr
(
self
,
'start_at'
):
# we still have start_at so skip the task
self
.
skip_task
=
True
elif
hasattr
(
self
,
'step'
)
and
self
.
step
:
resp
=
raw_input
(
'Perform task:
%
s (y/n/c): '
%
name
)
resp
=
raw_input
(
'Perform task:
%
s (y/n/c): '
%
name
)
if
resp
.
lower
()
in
[
'y'
,
'yes'
]:
if
resp
.
lower
()
in
[
'y'
,
'yes'
]:
self
.
skip_task
=
False
self
.
skip_task
=
False
...
...
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