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
8655f64e
Commit
8655f64e
authored
Dec 07, 2012
by
Christopher A. Snapp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --list-hosts support to bin/ansible
add error handling when no arg passed to command module
parent
63788316
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
bin/ansible
+11
-0
No files found.
bin/ansible
View file @
8655f64e
...
...
@@ -52,6 +52,8 @@ class Cli(object):
parser
.
add_option
(
'-m'
,
'--module-name'
,
dest
=
'module_name'
,
help
=
"module name to execute (default=
%
s)"
%
C
.
DEFAULT_MODULE_NAME
,
default
=
C
.
DEFAULT_MODULE_NAME
)
parser
.
add_option
(
'--list-hosts'
,
dest
=
'listhosts'
,
action
=
'store_true'
,
help
=
"dump out a list of hosts matching input pattern, does not execute any modules!"
)
options
,
args
=
parser
.
parse_args
()
self
.
callbacks
.
options
=
options
...
...
@@ -73,6 +75,15 @@ class Cli(object):
print
>>
sys
.
stderr
,
"No hosts matched"
sys
.
exit
(
1
)
if
options
.
listhosts
:
for
host
in
hosts
:
print
'
%
s'
%
host
sys
.
exit
(
0
)
if
options
.
module_name
==
'command'
and
not
options
.
module_args
:
print
>>
sys
.
stderr
,
"No argument passed to command module"
sys
.
exit
(
1
)
sshpass
=
None
sudopass
=
None
options
.
ask_pass
=
options
.
ask_pass
or
C
.
DEFAULT_ASK_PASS
...
...
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