Ansible with Windows节点-如何创建目录

Ansible with Windows节点-如何创建目录,windows,ansible,Windows,Ansible,我需要创建C:\MSI文件夹来放置MSI文件。我的任务是: tasks: - name: Copy *.msi files from ./MSI to C:\MSI file: path=C:\MSI state=directory 但我得到了一个错误: TASK [Copy *.msi files from ./MSI to C:\MSI] *********************************** An exception occurred during task

我需要创建
C:\MSI
文件夹来放置MSI文件。我的任务是:

tasks:
  - name: Copy *.msi files from ./MSI to C:\MSI
    file: path=C:\MSI state=directory
但我得到了一个错误:

TASK [Copy *.msi files from ./MSI to C:\MSI] ***********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: + ~~~~~~~~~~~~~~~
fatal: [agentsmith]: FAILED! => {"changed": false, "failed": true, "msg": "The term '/usr/bin/python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."}
在详细模式下,我看到文件模块出于某种原因将
/usr/bin/python
放入Powershell脚本:

TASK [Copy *.msi files from ./MSI to C:\MSI] ***********************************
task path: /home/qaexpert/ansible-lab/tcagent.yml:8
<agentsmith> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO agentsmith
<agentsmith> EXEC Set-StrictMode -Version Latest
(New-Item -Type Directory -Path $env:temp -Name "ansible-tmp-1477410445.62-187863101456896").FullName | Write-Host -Separator '';
<agentsmith> PUT "/tmp/tmpqOJYen" TO "C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1477410445.62-187863101456896\file.ps1"
<agentsmith> EXEC Set-StrictMode -Version Latest
Try
{
/usr/bin/python 'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1477410445.62-187863101456896\file.ps1'
}
Catch
...
TASK[将*.msi文件从./msi复制到C:\msi]***********************************
任务路径:/home/qaexpert/ansible lab/tcagent.yml:8
在端口5986上为用户管理员建立到agentsmith的WINRM连接
EXEC Set StrictMode-最新版本
(新项目-类型目录-路径$env:temp-名称“ansible-tmp-1477410445.62-187863101456896”)。全名|写入主机-分隔符“”;
将“/tmp/tmpJojyen”置于“C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1477410445.62-187863101456896\file.ps1”
EXEC Set StrictMode-最新版本
尝试
{
/usr/bin/python'C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1477410445.62-187863101456896\file.ps1'
}
接住
...

Ansible查找
/usr/bin/python
,因为
文件
模块需要在目标系统上安装python。无法为Windows目标使用普通Ansible模块

有关详细信息,请参阅。在Windows主机上,只有中列出的模块可用


要替换常规的
文件
模块,请使用
win_文件
模块。

Ansible查找
/usr/bin/python
,因为
文件
模块需要在目标系统上安装python。无法为Windows目标使用普通Ansible模块

有关详细信息,请参阅。在Windows主机上,只有中列出的模块可用

要更换常规的
文件
模块,请使用
win\u文件
模块