Hi All,
I have created a playbook to execute a VBScript on windows server and its showing error while performing the syntax check. Kindly have a look and please help me in this regard.
Hi All,
I have created a playbook to execute a VBScript on windows server and its showing error while performing the syntax check. Kindly have a look and please help me in this regard.
Your spacing is all messed up. Try this (I have not used these modules so there may be additional issues):
Hi Dick,
Thanks for your mail.
As per your mail I have tried the same and found the issue persist. Kindly find the details mentioned below.
[root@Y1972-206 jaywin]# cat win5.yml
Hi Dick,
Thanks for your mail.
As per your mail I have tried the same and found the issue persist. Kindly find the details mentioned below.
Actually the original error is fixed, but now a new one arised.
[root@Y1972-206 jaywin]# cat win5.yml
name: Copy PsExec
win_copy:
src: /home/testuser/jaytest/g-prediscover.vbe
dest: C:\temp
force: noname: Run powershell as a specific domain user
win_command: C:\Windows\SysWOW64\cscript.exe g-prediscover.vbe -n 2 +2
executable: C:\temp\g-prediscover.vbe
elevated: yes
nobanner: yes
interactive: yes
[root@Y1972-206 jaywin]# ansible-playbook -i inventory --syntax-check win5.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this contextThe error appears to be in ‘/opt/jaywin/win5.yml’: line 10, column 15, but may
be elsewhere in the file depending on the exact syntax problem.The offending line appears to be:
win_command: C:\Windows\SysWOW64\cscript.exe g-prediscover.vbe -n 2 +2
executable: C:\temp\g-prediscover.vbe
^ here
Again, I have no experience whatsoever with the windows modules, but from the docs alone one can see that the win_command module does not have any of the parameters that you use:
https://docs.ansible.com/ansible/latest/modules/win_command_module.html
Browsing through the windows module list, I think you mixed things up and want to use the win_psexec module?
Because that does have all the parameters you use:
https://docs.ansible.com/ansible/latest/modules/win_psexec_module.html
I noticed that this needs a ‘command’ parameters.
Adding the bits of the puzzle:
Hi Dick,
No luck so far
[root@Y1972-206 jaywin]# cat win6.yml