Added option to change ssh executable path (#17377)

This commit is contained in:
Andrea Tartaglia 2016-09-07 16:41:43 +01:00 committed by Toshio Kuratomi
parent 07e713e7c6
commit dd71469bb7
3 changed files with 10 additions and 5 deletions

View file

@ -144,7 +144,7 @@ class Connection(ConnectionBase):
if self._play_context.verbosity > 3:
self._command += ['-vvv']
elif binary == 'ssh':
elif binary == C.ANSIBLE_SSH_EXECUTABLE:
# Older versions of ssh (e.g. in RHEL 6) don't accept sftp -q.
self._command += ['-q']
@ -568,10 +568,12 @@ class Connection(ConnectionBase):
# python interactive-mode but the modules are not compatible with the
# interactive-mode ("unexpected indent" mainly because of empty lines)
ssh_executable = C.ANSIBLE_SSH_EXECUTABLE
if not in_data and sudoable:
args = ('ssh', '-tt', self.host, cmd)
args = (ssh_executable, '-tt', self.host, cmd)
else:
args = ('ssh', self.host, cmd)
args = (ssh_executable, self.host, cmd)
cmd = self._build_command(*args)
(returncode, stdout, stderr) = self._run(cmd, in_data, sudoable=sudoable)
@ -682,7 +684,8 @@ class Connection(ConnectionBase):
# TODO: reenable once winrm issues are fixed
# temporarily disabled as we are forced to currently close connections after every task because of winrm
# if self._connected and self._persistent:
# cmd = self._build_command('ssh', '-O', 'stop', self.host)
# ssh_executable = C.ANSIBLE_SSH_EXECUTABLE
# cmd = self._build_command(ssh_executable, '-O', 'stop', self.host)
#
# cmd = map(to_bytes, cmd)
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)