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
e2317082
Commit
e2317082
authored
Feb 09, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel' of
git://github.com/schmic/ansible
into schmic-devel
parents
0e8627b7
1205bbe1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
bin/ansible-playbook
+18
-2
No files found.
bin/ansible-playbook
View file @
e2317082
...
@@ -70,6 +70,8 @@ def main(args):
...
@@ -70,6 +70,8 @@ def main(args):
help
=
"dump out a list of hosts, each play will run against, does not run playbook!"
)
help
=
"dump out a list of hosts, each play will run against, does not run playbook!"
)
parser
.
add_option
(
'--syntax-check'
,
dest
=
'syntax'
,
action
=
'store_true'
,
parser
.
add_option
(
'--syntax-check'
,
dest
=
'syntax'
,
action
=
'store_true'
,
help
=
"do a playbook syntax check on the playbook, do not execute the playbook"
)
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"
)
options
,
args
=
parser
.
parse_args
(
args
)
options
,
args
=
parser
.
parse_args
(
args
)
...
@@ -84,7 +86,7 @@ def main(args):
...
@@ -84,7 +86,7 @@ def main(args):
sshpass
=
None
sshpass
=
None
sudopass
=
None
sudopass
=
None
if
not
options
.
listhosts
and
not
options
.
syntax
:
if
not
options
.
listhosts
and
not
options
.
syntax
and
not
options
.
listtasks
:
options
.
ask_pass
=
options
.
ask_pass
or
C
.
DEFAULT_ASK_PASS
options
.
ask_pass
=
options
.
ask_pass
or
C
.
DEFAULT_ASK_PASS
if
options
.
ask_pass
:
if
options
.
ask_pass
:
sshpass
=
getpass
.
getpass
(
prompt
=
"SSH password: "
)
sshpass
=
getpass
.
getpass
(
prompt
=
"SSH password: "
)
...
@@ -133,17 +135,31 @@ def main(args):
...
@@ -133,17 +135,31 @@ def main(args):
diff
=
options
.
diff
diff
=
options
.
diff
)
)
if
options
.
listhosts
:
if
options
.
listhosts
or
options
.
listtasks
:
print
'playbook:
%
s'
%
playbook
print
'playbook:
%
s'
%
playbook
playnum
=
0
playnum
=
0
for
(
play_ds
,
play_basedir
)
in
zip
(
pb
.
playbook
,
pb
.
play_basedirs
):
for
(
play_ds
,
play_basedir
)
in
zip
(
pb
.
playbook
,
pb
.
play_basedirs
):
playnum
+=
1
playnum
+=
1
play
=
ansible
.
playbook
.
Play
(
pb
,
play_ds
,
play_basedir
)
play
=
ansible
.
playbook
.
Play
(
pb
,
play_ds
,
play_basedir
)
label
=
play
.
name
label
=
play
.
name
if
options
.
listhosts
:
hosts
=
pb
.
inventory
.
list_hosts
(
play
.
hosts
)
hosts
=
pb
.
inventory
.
list_hosts
(
play
.
hosts
)
print
' hosts in play
%
s (
%
s): #
%
d'
%
(
playnum
,
label
,
len
(
hosts
))
print
' hosts in play
%
s (
%
s): #
%
d'
%
(
playnum
,
label
,
len
(
hosts
))
for
host
in
hosts
:
for
host
in
hosts
:
print
'
%
s'
%
host
print
'
%
s'
%
host
if
options
.
listtasks
:
matched_tags
,
unmatched_tags
=
play
.
compare_tags
(
pb
.
only_tags
)
unmatched_tags
.
discard
(
'all'
)
unknown_tags
=
set
(
pb
.
only_tags
)
-
(
matched_tags
|
unmatched_tags
)
if
unknown_tags
:
msg
=
'tag(s) not found in playbook:
%
s. possible values:
%
s'
unknown
=
','
.
join
(
sorted
(
unknown_tags
))
unmatched
=
','
.
join
(
sorted
(
unmatched_tags
))
raise
errors
.
AnsibleError
(
msg
%
(
unknown
,
unmatched
))
print
' tasks in play
%
s (
%
s): #
%
d'
%
(
playnum
,
label
,
len
(
play
.
tasks
()))
for
task
in
play
.
tasks
():
if
set
(
task
.
tags
)
.
intersection
(
pb
.
only_tags
):
print
'
%
s'
%
task
.
name
continue
continue
if
options
.
syntax
:
if
options
.
syntax
:
...
...
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