From 35b58955d62435c4bf601d42e803770a5d8f817d Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Mon, 21 Jan 2013 21:48:02 +0100 Subject: [PATCH] Fix paramiko for when no private key is specified --- lib/ansible/runner/connection_plugins/paramiko_ssh.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py index 898c24bf06..0f329bf7e5 100644 --- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py +++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py @@ -81,8 +81,12 @@ class Connection(object): if self.runner.remote_pass is not None: allow_agent = False try: + if self.runner.private_key_file: + key_filename = os.path.expanduser(self.runner.private_key_file) + else: + key_filename = None ssh.connect(self.host, username=user, allow_agent=allow_agent, look_for_keys=True, - key_filename=os.path.expanduser(self.runner.private_key_file), password=self.runner.remote_pass, + key_filename=key_filename, password=self.runner.remote_pass, timeout=self.runner.timeout, port=self.port) except Exception, e: msg = str(e)