我正在使用 ansible 管理云上的多个 Windows 主机,我需要创建一个日志文件并将其链接到另一个文件,因此我使用了以下剧本
- 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
Run Code Online (Sandbox Code Playgroud)
运行此剧本时,可以成功找到主机,但我收到以下错误报告
> 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 …Run Code Online (Sandbox Code Playgroud)