Reputation: 279
I want to run a wrapper.exe present on a remote windows server 2012 machine on the command prompt as follows :
wrapper.exe -t wrapper.conf
Using ansible i created a playbook to atleast try running the exe without any arguments. My playbook looks as follows:
---
- hosts: windows
tasks:
- name: Register as a service
raw: 'D:\builds\router\bin\wrapper.exe'
However, I get the following error:
fatal: [windows_ip]: FAILED! => {
"changed": false,
"failed": true,
"rc": 1,
"stderr": "#< CLIXML\r\n<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\"><S S=\"Error\">D:_x0008_uilds : The term 'D:_x0008_uilds' is not recognized as the name of a cmdlet, _x000D__x000A_</S><S S=\"Error\">function, script file, or operable program. Check the spelling of the name, or _x000D__x000A_</S><S S=\"Error\">if a path was included, verify that the path is correct and try again._x000D__x000A_</S><S S=\"Error\">At line:1 char:1_x000D__x000A_</S><S S=\"Error\">+ D:_x0008_uilds_x000D__x000A_</S><S S=\"Error\">+ ~~~~~~~~_x000D__x000A_</S><S S=\"Error\"> + CategoryInfo : ObjectNotFound: (D:_x0008_uilds:String) [], CommandNot _x000D__x000A_</S><S S=\"Error\"> FoundException_x000D__x000A_</S><S S=\"Error\"> + FullyQualifiedErrorId : CommandNotFoundException_x000D__x000A_</S><S S=\"Error\"> _x000D__x000A_</S><S S=\"Error\">outer_x0008_in\\wrapper.exe : The module 'outer_x0008_in' could not be loaded. For more _x000D__x000A_</S><S S=\"Error\">information, run 'Import-Module outer_x0008_in'._x000D__x000A_</S><S S=\"Error\">At line:2 char:1_x000D__x000A_</S><S S=\"Error\">+ outer_x0008_in\\wrapper.exe_x000D__x000A_</S><S S=\"Error\">+ ~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S=\"Error\"> + CategoryInfo : ObjectNotFound: (outer_x0008_in\\wrapper.exe:String) [] _x000D__x000A_</S><S S=\"Error\"> , CommandNotFoundException_x000D__x000A_</S><S S=\"Error\"> + FullyQualifiedErrorId : CouldNotAutoLoadModule_x000D__x000A_</S><S S=\"Error\"> _x000D__x000A_</S></Objs>",
"stdout": "",
"stdout_lines": []
}
What is the issue here?
Upvotes: 1
Views: 5682
Reputation: 3341
Or you can just use forward slashes (Powershell understands them)
"D:/builds/router/bin/wrapper.exe"
Upvotes: 1
Reputation: 3794
This is YAML related, you need to put '\\' to get a \. So in your case put it like this and it should work:
---
- hosts: windows
tasks:
- name: Register as a service
raw: 'D:\\builds\\router\\bin\\wrapper.exe'
Upvotes: 1