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
8d887d8d
Commit
8d887d8d
authored
Jul 14, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding back --start-at-task feature
Also implemented framework for --step, though it's not used yet
parent
f6c64a8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
lib/ansible/cli/playbook.py
+3
-3
lib/ansible/executor/connection_info.py
+6
-0
lib/ansible/executor/play_iterator.py
+11
-0
No files found.
lib/ansible/cli/playbook.py
View file @
8d887d8d
...
...
@@ -60,12 +60,12 @@ class PlaybookCLI(CLI):
# ansible playbook specific opts
parser
.
add_option
(
'--list-tasks'
,
dest
=
'listtasks'
,
action
=
'store_true'
,
help
=
"list all tasks that would be executed"
)
parser
.
add_option
(
'--list-tags'
,
dest
=
'listtags'
,
action
=
'store_true'
,
help
=
"list all available tags"
)
parser
.
add_option
(
'--step'
,
dest
=
'step'
,
action
=
'store_true'
,
help
=
"one-step-at-a-time: confirm each task before running"
)
parser
.
add_option
(
'--start-at-task'
,
dest
=
'start_at'
,
parser
.
add_option
(
'--start-at-task'
,
dest
=
'start_at
_task
'
,
help
=
"start the playbook at the task matching this name"
)
parser
.
add_option
(
'--list-tags'
,
dest
=
'listtags'
,
action
=
'store_true'
,
help
=
"list all available tags"
)
self
.
options
,
self
.
args
=
parser
.
parse_args
()
...
...
lib/ansible/executor/connection_info.py
View file @
8d887d8d
...
...
@@ -177,6 +177,8 @@ class ConnectionInformation:
self
.
no_log
=
False
self
.
check_mode
=
False
self
.
force_handlers
=
False
self
.
start_at_task
=
None
self
.
step
=
False
#TODO: just pull options setup to above?
# set options before play to allow play to override them
...
...
@@ -241,6 +243,10 @@ class ConnectionInformation:
self
.
check_mode
=
boolean
(
options
.
check
)
if
hasattr
(
options
,
'force_handlers'
)
and
options
.
force_handlers
:
self
.
force_handlers
=
boolean
(
options
.
force_handlers
)
if
hasattr
(
options
,
'step'
)
and
options
.
step
:
self
.
step
=
boolean
(
options
.
step
)
if
hasattr
(
options
,
'start_at_task'
)
and
options
.
start_at_task
:
self
.
start_at_task
=
options
.
start_at_task
# get the tag info from options, converting a comma-separated list
# of values into a proper list if need be. We check to see if the
...
...
lib/ansible/executor/play_iterator.py
View file @
8d887d8d
...
...
@@ -99,6 +99,17 @@ class PlayIterator:
self
.
_host_states
=
{}
for
host
in
inventory
.
get_hosts
(
self
.
_play
.
hosts
):
self
.
_host_states
[
host
.
name
]
=
HostState
(
blocks
=
self
.
_blocks
)
# if we're looking to start at a specific task, iterate through
# the tasks for this host until we find the specified task
if
connection_info
.
start_at_task
is
not
None
:
while
True
:
(
s
,
task
)
=
self
.
get_next_task_for_host
(
host
,
peek
=
True
)
if
s
.
run_state
==
self
.
ITERATING_COMPLETE
:
break
if
task
.
get_name
()
!=
connection_info
.
start_at_task
:
self
.
get_next_task_for_host
(
host
)
else
:
break
# Extend the play handlers list to include the handlers defined in roles
self
.
_play
.
handlers
.
extend
(
play
.
compile_roles_handlers
())
...
...
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