如何在没有本地复制和 ssh 安装的情况下将文件从远程 Windows 复制到远程 linux

问题描述

操作系统:Wk16 与 Debian 10.4 Ansible:2.9

大家好

我需要从远程 Windows 向远程 linux 发送文件,无需在本地复制,无需在 Windows 服务器中安装 ssh 包。

A Win_server <-- Ansible role executor -- B Ansible_host         C linux_host
|
|                                                                   ^
|___SENDING FILE_______________________________________TO___________|

非常感谢

解决方法

在 Ansible 文档中签出同步模块:https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html

另外,注意在目标之间建立直接的 ssh 连接。

提示:可以在 windows 上激活 ssh 并建立与 linux 机器的连接。注意风险!

另一种方法是使用 fetch 和 copy 来做三角形复制,使用 Ansible 服务器作为肘部。

,

今天我如@guistela 所说的那样将 SSH 放在 Windows 中。

我使用 ansible 在 Windows 主机上安装了“Posh-SSH”:

  1. 手册下载地址: https://www.powershellgallery.com/packages/Posh-SSH
  2. 向 Windows 主机发送文件包含要发送的文件。
  3. 使用微软步骤安装:Installing PowerShell modules from a NuGet package
  4. Possh-SSH 使用命令,更多信息在这里: powershell-scp-to-transfer-files-between-windows-linux
  • 开放端口
  • 发送文件
  • 关闭端口

这 4 个通用步骤允许将文件从 windows 发送到 linux 主机。

诚挚的