Commit 788d2bf8 by Michael DeHaan

Allow playbook to take --connection=local for easier reuse of playbook in…

Allow playbook to take --connection=local for easier reuse of playbook in kickstart w/o specifying connection: in
the playbook itself.  Both work.
parent 6b500788
...@@ -33,7 +33,7 @@ def main(args): ...@@ -33,7 +33,7 @@ def main(args):
# create parser for CLI options # create parser for CLI options
usage = "%prog playbook.yml" usage = "%prog playbook.yml"
parser = utils.base_parser(constants=C, usage=usage) parser = utils.base_parser(constants=C, usage=usage, connect_opts=True)
parser.add_option('-e', '--extra-vars', dest='extra_vars', parser.add_option('-e', '--extra-vars', dest='extra_vars',
help='arguments to pass to the inventory script') help='arguments to pass to the inventory script')
parser.add_option('-O', '--override-hosts', dest="override_hosts", default=None, parser.add_option('-O', '--override-hosts', dest="override_hosts", default=None,
...@@ -43,8 +43,6 @@ def main(args): ...@@ -43,8 +43,6 @@ def main(args):
if len(args) == 0: if len(args) == 0:
parser.print_help(file=sys.stderr) parser.print_help(file=sys.stderr)
#QUESTION for M.D. This would match bin/ansible's behavior. Do we want them consistent?
#parser.print_help()
return 1 return 1
sshpass = None sshpass = None
...@@ -68,7 +66,7 @@ def main(args): ...@@ -68,7 +66,7 @@ def main(args):
forks=options.forks, debug=options.debug, verbose=True, forks=options.forks, debug=options.debug, verbose=True,
remote_pass=sshpass, remote_port=options.remote_port, remote_pass=sshpass, remote_port=options.remote_port,
callbacks=playbook_cb, runner_callbacks=runner_cb, stats=stats, callbacks=playbook_cb, runner_callbacks=runner_cb, stats=stats,
timeout=options.timeout, timeout=options.timeout, transport=options.connection
) )
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment