def connection_options
options = config_file_options
options[:port] = config[:ssh_port] if config[:ssh_port]
options[:password] = config[:ssh_password] if config[:ssh_password]
options[:keys] = [identity_file] if identity_file
options[:gateway] = config[:ssh_gateway] if config[:ssh_gateway]
options[:forward_agent] = true if config[:forward_agent]
if !config[:host_key_verify]
options[:paranoid] = false
options[:user_known_hosts_file] = "/dev/null"
end
if config[:ssh_keepalive]
options[:keepalive] = config[:ssh_keepalive]
options[:keepalive_interval] = config[:ssh_keepalive_interval]
end
options[:config] = false
options
end