【问题标题】:How ansible copy file from remote windows to remote linux without local copy and ssh install in windows如何在没有本地复制和ssh安装的情况下将文件从远程windows复制到远程linux
【发布时间】:2021-04-13 22:43:56
【问题描述】:

操作系统: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___________|

非常感谢

【问题讨论】:

    标签: linux windows ansible file-transfer


    【解决方案1】:

    Ansible 文档中的 Checkout syncronize 模块:https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html

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

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

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

    【讨论】:

    • 嗨!但我需要没有 ssh。我更新答案。谢谢。
    • 恐怕你的情况没有其他办法了...使用ansible localhost作为肘部,放手吧!
    • 是的,我可以,但我需要没有这个解决方案。我搜索如何将文件内容放入 var 并在使用 var 的内容写入文件之后。
    【解决方案2】:

    今天我按照@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 主机。

    真诚的

    【讨论】:

      猜你喜欢
      • 2016-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多