I'm a little suspicious, since the error you're getting is "Access is 
Denied" not "The network name cannot be found" (which is what I'd expect if 
the path/quotes were being munged).

That said, throwing the extra command interpreter in there really makes you 
have to thread the needle- you have to deal with:
- YAML quoting
- outer cmd quoting
- powershell quoting
- inner cmd quoting

For better or for worse, "raw" is really powershell, so why not at least 
scrape the bottom-most layer off and do:

- raw: net use "\\server\share with spaces\" ; (other command here)



On Thursday, April 21, 2016 at 2:33:05 PM UTC-7, Alexey Larsky wrote:
>
> I've stuck with using raw module with double quoted parameters under 
> Windows.
> According with http://docs.ansible.com/ansible/intro_windows.html
> - raw: cmd /c "net use *\\server\share*  & second_command"  works, but *how 
> to use double quoted parameter(s) with spaces inside cmd /c "..." ?*
> - raw: cmd /c "net use "*\\server\share with spaces*" & second_command" 
> throw error: fatal: [...]: FAILED! => {"changed": false, "failed": true, 
> "invocation": {"module_args": {"_raw_params": "cmd /c \"net use 
> \"*\\\\**server\share 
> with spaces*\"\""}, "module_name": "raw"}, "rc": 1, "stderr": "System 
> error 5 has occurred.\r\n\r\nAccess is denied.\r\n\r\n", "stdout": "", 
> "stdout_lines": []}
>
> PS. Ansible: 2.0.1.0, sever: CentOS Linux release 7.2.1511 (Core), 
> client: Windows 7 SP1 x64.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ead4b78b-affa-4b74-9b1c-6f19b0c78935%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to