|
|
@ -52,6 +52,8 @@ class Cli(object):
|
|
|
|
parser.add_option('-m', '--module-name', dest='module_name',
|
|
|
|
parser.add_option('-m', '--module-name', dest='module_name',
|
|
|
|
help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME,
|
|
|
|
help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME,
|
|
|
|
default=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()
|
|
|
|
options, args = parser.parse_args()
|
|
|
|
self.callbacks.options = options
|
|
|
|
self.callbacks.options = options
|
|
|
|
|
|
|
|
|
|
|
@ -73,6 +75,15 @@ class Cli(object):
|
|
|
|
print >>sys.stderr, "No hosts matched"
|
|
|
|
print >>sys.stderr, "No hosts matched"
|
|
|
|
sys.exit(1)
|
|
|
|
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
|
|
|
|
sshpass = None
|
|
|
|
sudopass = None
|
|
|
|
sudopass = None
|
|
|
|
options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
|
|
|
|
options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
|
|
|
|