Added preliminary support for --sudo to ansible, playbook support and further testing pending.

This commit is contained in:
Michael DeHaan
2012-03-29 01:36:29 -04:00
parent 011a0ecbdf
commit 81e3496037
4 changed files with 14 additions and 22 deletions

View File

@@ -67,6 +67,8 @@ class Cli(object):
help='condense output')
parser.add_option('-P', '--poll', default=C.DEFAULT_POLL_INTERVAL, type='int',
dest='poll_interval', help='set the poll interval if using -B')
parser.add_option("-s", "--sudo", default=False, action="store_true",
dest='sudo', help="run operations with sudo (nopasswd)")
parser.add_option('-t', '--tree', dest='tree', default=None,
help='log output to this directory')
parser.add_option('-T', '--timeout', default=C.DEFAULT_TIMEOUT, type='int',
@@ -107,7 +109,7 @@ 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, verbose=True,
callbacks=self.callbacks, sudo=options.sudo, verbose=True,
)
return (runner, runner.run())

View File

@@ -45,7 +45,6 @@ def main(args):
help="run playbook against these hosts regardless of inventory settings")
parser.add_option('-p', '--port', default=C.DEFAULT_REMOTE_PORT, type='int',
dest='remote_port', help='set the remote ssh port')
parser.add_option('-T', '--timeout', default=C.DEFAULT_TIMEOUT, type='int',
dest='timeout', help="set the SSH timeout in seconds")