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
2da8a986
Commit
2da8a986
authored
Mar 09, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10414 from bcoca/showing_tags
added list-tags option and also show tags in list-tasks option
parents
d5164e9e
8267bb2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
bin/ansible-playbook
+20
-9
No files found.
bin/ansible-playbook
View file @
2da8a986
...
...
@@ -91,6 +91,8 @@ def main(args):
help
=
"perform a syntax check on the playbook, but do not execute it"
)
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'
,
...
...
@@ -123,7 +125,7 @@ def main(args):
options
.
ask_vault_pass
=
options
.
ask_vault_pass
or
C
.
DEFAULT_ASK_VAULT_PASS
if
options
.
listhosts
or
options
.
syntax
or
options
.
listtasks
:
if
options
.
listhosts
or
options
.
syntax
or
options
.
listtasks
or
options
.
listtags
:
(
_
,
_
,
_
,
vault_pass
)
=
utils
.
ask_passwords
(
ask_vault_pass
=
options
.
ask_vault_pass
)
else
:
options
.
ask_pass
=
options
.
ask_pass
or
C
.
DEFAULT_ASK_PASS
...
...
@@ -215,7 +217,7 @@ def main(args):
display
(
callbacks
.
banner
(
"FLUSHING FACT CACHE"
))
pb
.
SETUP_CACHE
.
flush
()
if
options
.
listhosts
or
options
.
listtasks
or
options
.
syntax
:
if
options
.
listhosts
or
options
.
listtasks
or
options
.
syntax
or
options
.
listtags
:
print
''
print
'playbook:
%
s'
%
playbook
print
''
...
...
@@ -232,14 +234,23 @@ def main(args):
for
host
in
hosts
:
print
'
%
s'
%
host
if
options
.
listtasks
:
print
' play #
%
d (
%
s):
'
%
(
playnum
,
label
)
if
options
.
listta
gs
or
options
.
listta
sks
:
print
' play #
%
d (
%
s):
\t
TAGS: [
%
s]'
%
(
playnum
,
label
,
','
.
join
(
sorted
(
set
(
play
.
tags
)))
)
for
task
in
pb
.
tasks_to_run_in_play
(
play
):
if
getattr
(
task
,
'name'
,
None
)
is
not
None
:
# meta tasks have no names
print
'
%
s'
%
task
.
name
if
options
.
listhosts
or
options
.
listtasks
:
if
options
.
listtags
:
tags
=
[]
for
task
in
pb
.
tasks_to_run_in_play
(
play
):
tags
.
extend
(
task
.
tags
)
print
' TASK TAGS: [
%
s]'
%
(
', '
.
join
(
sorted
(
set
(
tags
)
.
difference
([
'untagged'
]))))
if
options
.
listtasks
:
for
task
in
pb
.
tasks_to_run_in_play
(
play
):
if
getattr
(
task
,
'name'
,
None
)
is
not
None
:
# meta tasks have no names
print
'
%
s
\t
TAGS: [
%
s]'
%
(
task
.
name
,
', '
.
join
(
sorted
(
set
(
task
.
tags
)
.
difference
([
'untagged'
]))))
if
options
.
listhosts
or
options
.
listtasks
or
options
.
listtags
:
print
''
continue
...
...
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