Update manpages, fix missing variable assignment

This commit is contained in:
Michael DeHaan 2012-04-13 19:33:19 -04:00
parent f2465e0571
commit c3cad50075
5 changed files with 41 additions and 8 deletions

View file

@ -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,6 +70,7 @@ 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:

View file

@ -67,7 +67,7 @@ def main(args):
host_list=options.inventory, override_hosts=override_hosts,
extra_vars=options.extra_vars,
forks=options.forks, debug=options.debug, verbose=True,
remote_pass=sshpass, remote_port=options.remote_port,
remote_pass=sshpass,
callbacks=playbook_cb, runner_callbacks=runner_cb, stats=stats,
timeout=options.timeout, transport=options.connection,
sudo_pass=sudopass

View file

@ -34,6 +34,10 @@ The names of one or more YAML format files to run as ansible playbooks.
OPTIONS
-------
*-D*, *--debug*
Print any messages the remote module sends to standard error to the console
*-i* 'PATH', *--inventory=*'PATH'::
@ -55,11 +59,28 @@ Level of parallelism. 'NUM' is specified as an integer, the default is 5.
Prompt for the SSH password instead of assuming key-based authentication with ssh-agent.
*-K*, *--ask-sudo-pass*::
Prompt for the password to use for playbook plays that request sudo access, if any
*-T* 'SECONDS', *--timeout=*'SECONDS'::
Connection timeout to use when trying to talk to hosts, in 'SECONDS'.
*-e* 'EXTRA_VARS', *--extra_vars=*'EXTRA_VARS'::
An additional list of space delimited key=value pairs to pass into the playbook that are not
declared in the vars section of the playbook.
*-O* 'OVERRIDE_HOSTS', *--override-hosts=*'OVERRIDE_HOSTS'::
Ignore the inventory file and run the playbook against only these hosts. "hosts:" line
in playbook should be set to 'all' when using this option.
ENVIRONMENT
-----------

View file

@ -60,16 +60,25 @@ The 'DIRECTORY' to load modules from. The default is '/usr/share/ansible'.
The 'ARGUMENTS' to pass to the module.
*-D*, *--debug*
Print any messages the remote module sends to standard error to the console
*-k*, *--ask-pass*::
Prompt for the SSH password instead of assuming key-based authentication with ssh-agent.
*-K*, *--ask-sudo-pass*::
Prompt for the password to use with --sudo, if any
*-o*, *--one-line*::
Try to output everything on one line.
*-s*, *--sudo*::
Run the command as the user given by -u and sudo to root.
*-t* 'DIRECTORY', *--tree=*'DIRECTORY'::
@ -91,14 +100,14 @@ Run commands in the background, killing the task after 'NUM' seconds.
Poll a background job every 'NUM' seconds. Requires *-B*.
*-u* 'USERNAME', *--remote-user=*'USERNAME'::
Use this remote 'USERNAME' instead of root.
*-c* 'CONNECTION', *--connection=*'CONNECTION'::
Connection type to use. Possible options are 'paramiko' and 'local'.
Connection type to use. Possible options are 'paramiko' (SSH) and 'local'.
Local is mostly useful for crontab or kickstarts.
INVENTORY

View file

@ -279,7 +279,7 @@ class SortedOptParser(optparse.OptionParser):
self.option_list.sort(key=methodcaller('get_opt_string'))
return optparse.OptionParser.format_help(self, formatter=None)
def base_parser(constants=C, usage="", output_opts=False, runas_opts=False, async_opts=False, connect_opts=False):
def base_parser(constants=C, usage="", output_opts=False, port_opts=False, runas_opts=False, async_opts=False, connect_opts=False):
''' create an options parser for any ansible script '''
parser = SortedOptParser(usage)
@ -300,9 +300,11 @@ def base_parser(constants=C, usage="", output_opts=False, runas_opts=False, asyn
parser.add_option('-T', '--timeout', default=constants.DEFAULT_TIMEOUT, type='int',
dest='timeout',
help="override the SSH timeout in seconds (default=%s)" % constants.DEFAULT_TIMEOUT)
parser.add_option('-p', '--port', default=constants.DEFAULT_REMOTE_PORT, type='int',
dest='remote_port',
help="override the remote ssh port (default=%s)" % constants.DEFAULT_REMOTE_PORT)
if port_opts:
parser.add_option('-p', '--port', default=constants.DEFAULT_REMOTE_PORT, type='int',
dest='remote_port',
help="override the remote ssh port (default=%s)" % constants.DEFAULT_REMOTE_PORT)
if output_opts:
parser.add_option('-o', '--one-line', dest='one_line', action='store_true',