I'm using ansible to manage several windows hosts on the cloud, I need to create a log file and link it to another file, so I use the 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
when running this playbook, the hosts can be found successfully, but I got the following error report
> 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}
and I tryed this command on the remote host in the same directory, it can be execute successfully. I don't know what to do......