Merge pull request #5002 from ovcharenko/devel

Allow to specify ansible_ssh_private_key_file location related to user home directory
This commit is contained in:
jctanner 2013-11-22 06:39:07 -08:00
commit 5c84d7e445
2 changed files with 9 additions and 0 deletions

View file

@ -587,6 +587,9 @@ class Runner(object):
actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file) actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file)
self.sudo_pass = inject.get('ansible_sudo_pass', self.sudo_pass) self.sudo_pass = inject.get('ansible_sudo_pass', self.sudo_pass)
if actual_private_key_file is not None:
actual_private_key_file = os.path.expanduser(actual_private_key_file)
if self.accelerate and actual_transport != 'local': if self.accelerate and actual_transport != 'local':
#Fix to get the inventory name of the host to accelerate plugin #Fix to get the inventory name of the host to accelerate plugin
if inject.get('ansible_ssh_host', None): if inject.get('ansible_ssh_host', None):
@ -626,6 +629,10 @@ class Runner(object):
actual_private_key_file = delegate_info.get('ansible_ssh_private_key_file', self.private_key_file) actual_private_key_file = delegate_info.get('ansible_ssh_private_key_file', self.private_key_file)
actual_transport = delegate_info.get('ansible_connection', self.transport) actual_transport = delegate_info.get('ansible_connection', self.transport)
self.sudo_pass = delegate_info.get('ansible_sudo_pass', self.sudo_pass) self.sudo_pass = delegate_info.get('ansible_sudo_pass', self.sudo_pass)
if actual_private_key_file is not None:
actual_private_key_file = os.path.expanduser(actual_private_key_file)
for i in delegate_info: for i in delegate_info:
if i.startswith("ansible_") and i.endswith("_interpreter"): if i.startswith("ansible_") and i.endswith("_interpreter"):
inject[i] = delegate_info[i] inject[i] = delegate_info[i]

View file

@ -81,7 +81,9 @@ class ActionModule(object):
self.runner.remote_user) self.runner.remote_user)
private_key = inject.get('ansible_ssh_private_key_file', self.runner.private_key_file) private_key = inject.get('ansible_ssh_private_key_file', self.runner.private_key_file)
if not private_key is None: if not private_key is None:
private_key = os.path.expanduser(private_key)
options['private_key'] = private_key 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)