Commit adbca9d2 by Timothy Appnel

Fixed identity key logic.

parent 9f170f57
...@@ -77,12 +77,11 @@ class ActionModule(object): ...@@ -77,12 +77,11 @@ class ActionModule(object):
if not dest_host is src_host: if not dest_host is src_host:
user = inject.get('ansible_ssh_user', user = inject.get('ansible_ssh_user',
self.runner.remote_user) self.runner.remote_user)
private_key = \
# should we support ssh_password and ssh_port here??
options['private_key'] = \
inject.get('ansible_ssh_private_key_file', inject.get('ansible_ssh_private_key_file',
self.runner.private_key_file) self.runner.private_key_file)
if not private_key is None:
options['private_key'] = private_key
src = self._process_origin(src_host, src, user) src = self._process_origin(src_host, src, user)
dest = self._process_origin(dest_host, dest, user) dest = self._process_origin(dest_host, dest, user)
......
...@@ -99,10 +99,6 @@ def main(): ...@@ -99,10 +99,6 @@ def main():
rsync = module.params.get('local_rsync_path', 'rsync') rsync = module.params.get('local_rsync_path', 'rsync')
temp = os.path.dirname(os.path.realpath(__file__)) temp = os.path.dirname(os.path.realpath(__file__))
if not private_key and ('@' in dest or '@' in source):
return module.fail_json(msg='A private key is required for remote connections.'
)
cmd = '%s --archive --delay-updates --compress' % rsync cmd = '%s --archive --delay-updates --compress' % rsync
if verbosity: if verbosity:
cmd = '%s -%s' % (cmd, 'v' * int(verbosity)) cmd = '%s -%s' % (cmd, 'v' * int(verbosity))
...@@ -112,8 +108,11 @@ def main(): ...@@ -112,8 +108,11 @@ def main():
cmd = cmd + ' --temp-dir ' + temp cmd = cmd + ' --temp-dir ' + temp
if module.boolean(delete): if module.boolean(delete):
cmd = cmd + ' --delete-after' cmd = cmd + ' --delete-after'
if private_key: if private_key is None:
cmd = cmd + " --rsh '%s -i %s -o %s'" % ('ssh', private_key, private_key = ''
else:
private_key = '-i '+ private_key
cmd = cmd + " --rsh '%s %s -o %s'" % ('ssh', private_key,
'StrictHostKeyChecking=no') # need ssh param 'StrictHostKeyChecking=no') # need ssh param
if rsync_path: if rsync_path:
cmd = cmd + ' --rsync-path ' + rsync_path cmd = cmd + ' --rsync-path ' + rsync_path
......
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