我正在使用ansible管理云上的几个windows主机,我需要创建一个日志文件并将其链接到另一个文件,所以我使用follow playbook
- name: init the directory structure of windows
hosts: '{{windows_hosts}}'
tasks:
- name: create log file and link it to log directory
win_command: mklink log D:\prod\log
args:
chdir: D:\prod\project
运行此剧本时,可以成功找到主机,但我收到以下错误报告
> TASK [Gathering Facts]
> ********* ok: [111.111.2.40]
>
> TASK [create log file and link it to log directory]
> ********* fatal: [111.231.76.40]: FAILED! => {"changed": false, "cmd": "mklink log
> D:\\prod\\log", "msg": "Exception calling \"SearchPath\" with \"1\"
> argument(s): \"Could not locate the following executable
> mklink.exe\"", "rc": 2}
我在同一目录下的远程主机上尝试了这个命令,它可以成功执行。我不知道该怎么办......