Extract ssh and sshkit configuration

This commit is contained in:
Donal McBreen
2023-07-26 12:26:23 +01:00
parent eb8c97a417
commit 94d6a763a8
9 changed files with 127 additions and 76 deletions

View File

@@ -13,12 +13,12 @@ module Mrsk::Commands
def run_over_ssh(*command, host:)
"ssh".tap do |cmd|
if config.ssh_proxy && config.ssh_proxy.is_a?(Net::SSH::Proxy::Jump)
cmd << " -J #{config.ssh_proxy.jump_proxies}"
elsif config.ssh_proxy && config.ssh_proxy.is_a?(Net::SSH::Proxy::Command)
cmd << " -o ProxyCommand='#{config.ssh_proxy.command_line_template}'"
if config.ssh.proxy && config.ssh.proxy.is_a?(Net::SSH::Proxy::Jump)
cmd << " -J #{config.ssh.proxy.jump_proxies}"
elsif config.ssh.proxy && config.ssh.proxy.is_a?(Net::SSH::Proxy::Command)
cmd << " -o ProxyCommand='#{config.ssh.proxy.command_line_template}'"
end
cmd << " -t #{config.ssh_user}@#{host} '#{command.join(" ")}'"
cmd << " -t #{config.ssh.user}@#{host} '#{command.join(" ")}'"
end
end