Hi,
so if I run on the command line, having used the inventory file to add user/password details under windows:vars
ansible mesh -u user1 -m win_shell -a “dir chdir=C:\Temp”
then I get
mesh | SUCCESS | rc=0 >>
Directory: C:\Temp
Mode LastWriteTime Length Name
But with a playbook
- name: Run a series of debug tasks to see the value of variables
hosts: mesh
user: user1
tasks: - name: list all the files in temp on c drive
win_command: dir
args:
chdir: c:\temp
I get
TASK [list all the files in temp on c drive] ***********************************
fatal: [mesh]: FAILED! => {“changed”: false, “cmd”: “dir”, “failed”: true, “msg”: “The system cannot find the file specified”, “rc”: 2}
The win_command module docs show do not show escaping of backslashes or quotes.
What am I doing wrong?
Regards,
John