首页 > 解决方案 > 您可以仅使用命令在 Windows 上设置 FTP 服务器吗?

问题描述

我需要自动构建 Windows10-VM(使用 packer/ansible),包括一个工作的 FTP 站点。第一步 - 启用必要的 Windows 功能 - 可以通过使用 ansible 的win_feature-module 来完成,看起来像这样(编辑:第一个解决方案仅对 Windows Server 有效。添加了第二个解决方案):

- name: Enable windows features required for setting up ftp
  win_feature:
    name: FTP Server
    state: present
    include_sub_features: true
    include_management_tools: true

- name: Enable windows features required for setting up ftp
  win_shell: Enable-WindowsOptionalFeature -Online -FeatureName "IIS-FTPServer","IIS-FTPSvc" -all

至少对我来说,困难的部分实际上是设置 FTP 站点。由于它必须通过 ansible 实现自动化,因此我不能像往常一样使用 GUI(IIS 管理控制台)。有没有办法只使用命令来完成这个?

标签: windowspowershellansibleftpwindows-10

解决方案


推荐阅读