summaryrefslogtreecommitdiff
path: root/bin/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ansible')
-rwxr-xr-xbin/ansible10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/ansible b/bin/ansible
index 0543aed79e..f254eaf3ff 100755
--- a/bin/ansible
+++ b/bin/ansible
@@ -47,7 +47,7 @@ class Cli(object):
def parse(self):
''' create an options parser for bin/ansible '''
- parser = utils.base_parser(constants=C, runas_opts=True, async_opts=True,
+ parser = utils.base_parser(constants=C, port_opts=True, runas_opts=True, async_opts=True,
output_opts=True, connect_opts=True, usage='%prog <host-pattern> [options]')
parser.add_option('-a', '--args', dest='module_args',
help="module arguments", default=C.DEFAULT_MODULE_ARGS)
@@ -70,9 +70,12 @@ class Cli(object):
pattern = args[0]
sshpass = None
+ sudopass = None
if options.ask_pass:
sshpass = getpass.getpass(prompt="SSH password: ")
-
+ if options.ask_sudo_pass:
+ sudopass = getpass.getpass(prompt="sudo password: ")
+
if options.tree:
utils.prepare_writeable_dir(options.tree)
@@ -86,7 +89,8 @@ class Cli(object):
host_list=options.inventory, timeout=options.timeout,
remote_port=options.remote_port, forks=options.forks,
background=options.seconds, pattern=pattern,
- callbacks=self.callbacks, sudo=options.sudo, verbose=True,
+ callbacks=self.callbacks, sudo=options.sudo,
+ sudo_pass=sudopass, verbose=True,
transport=options.connection, debug=options.debug
)
return (runner, runner.run())