From 2222f6df58385828922014e31965ba485befa5fd Mon Sep 17 00:00:00 2001 From: Aleksey Ovcharenko Date: Fri, 22 Nov 2013 01:47:03 +0200 Subject: [PATCH] Allow to specify ansible_ssh_private_key_file location related to user home directory --- lib/ansible/runner/__init__.py | 4 ++-- lib/ansible/runner/action_plugins/synchronize.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index eebb5349c83..6118c2b8a6f 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -584,7 +584,7 @@ class Runner(object): actual_user = inject.get('ansible_ssh_user', self.remote_user) actual_pass = inject.get('ansible_ssh_pass', self.remote_pass) actual_transport = inject.get('ansible_connection', self.transport) - actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file) + actual_private_key_file = os.path.expanduser(inject.get('ansible_ssh_private_key_file', self.private_key_file)) self.sudo_pass = inject.get('ansible_sudo_pass', self.sudo_pass) if self.accelerate and actual_transport != 'local': @@ -623,7 +623,7 @@ class Runner(object): actual_port = delegate_info.get('ansible_ssh_port', port) actual_user = delegate_info.get('ansible_ssh_user', actual_user) actual_pass = delegate_info.get('ansible_ssh_pass', actual_pass) - actual_private_key_file = delegate_info.get('ansible_ssh_private_key_file', self.private_key_file) + actual_private_key_file = os.path.expanduser(delegate_info.get('ansible_ssh_private_key_file', self.private_key_file)) actual_transport = delegate_info.get('ansible_connection', self.transport) self.sudo_pass = delegate_info.get('ansible_sudo_pass', self.sudo_pass) for i in delegate_info: diff --git a/lib/ansible/runner/action_plugins/synchronize.py b/lib/ansible/runner/action_plugins/synchronize.py index 0004136dab8..3ff74cb0537 100644 --- a/lib/ansible/runner/action_plugins/synchronize.py +++ b/lib/ansible/runner/action_plugins/synchronize.py @@ -79,7 +79,7 @@ class ActionModule(object): if not dest_host is src_host: user = inject.get('ansible_ssh_user', self.runner.remote_user) - private_key = inject.get('ansible_ssh_private_key_file', self.runner.private_key_file) + private_key = os.path.expanduser(inject.get('ansible_ssh_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)