Commit 82c3b4e6 by Brian Coca

now ssh connection plugin will only pass user as an option to ssh if it is

differnt from the current user. This should enable overrides for user in
.ssh/config w/o breaking any current functionality.

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
parent 868af1a8
...@@ -23,6 +23,7 @@ import pipes ...@@ -23,6 +23,7 @@ import pipes
import random import random
import select import select
import fcntl import fcntl
import pwd
import ansible.constants as C import ansible.constants as C
from ansible.callbacks import vvv from ansible.callbacks import vvv
from ansible import errors from ansible import errors
...@@ -62,7 +63,8 @@ class Connection(object): ...@@ -62,7 +63,8 @@ class Connection(object):
else: else:
self.common_args += ["-o", "KbdInteractiveAuthentication=no", self.common_args += ["-o", "KbdInteractiveAuthentication=no",
"-o", "PasswordAuthentication=no"] "-o", "PasswordAuthentication=no"]
self.common_args += ["-o", "User="+self.user] if self.user != pwd.getpwuid(os.geteuid())[0]:
self.common_args += ["-o", "User="+self.user]
self.common_args += ["-o", "ConnectTimeout=%d" % self.runner.timeout] self.common_args += ["-o", "ConnectTimeout=%d" % self.runner.timeout]
return self return self
......
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