From 80fd22dce65e3b009e74624fc9494cc4d2682942 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 9 Nov 2013 13:29:39 +0100 Subject: [PATCH] Check real user's known_hosts when sudo ansible... closes #4834 --- lib/ansible/runner/connection_plugins/ssh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index 5ee45ba6a9b..7e353746506 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -116,7 +116,7 @@ class Connection(object): os.close(self.wfd) def not_in_host_file(self, host): - host_file = os.path.expanduser("~/.ssh/known_hosts") + host_file = os.path.expanduser(os.path.expandvars("~${USER}/.ssh/known_hosts")) if not os.path.exists(host_file): print "previous known host file not found" return True