Windows - multiple paths with spaces

Good morning all! I’m fairly new to Ansible but I’ve been banging away at it for several weeks and feel like I’m getting a decent understanding of it. However I’ve run into an issue I’m struggling with. I have a playbook for Windows Server 2012 R2…95% of it works great. But I’m stuck on literally the last item I need to add. I’m trying to use the raw module to call and .exe and pass in some arguments. The path to the .exe has some spaces, as does on of the arguments. This is a rough approximation of what I’m trying to do looks like:

  • name: Register database
    raw: ‘“C:\Program Files\Company Name\Dir3\dir4\name.name.name.name.exe” --setupServer --product=ProductName --dbDir=“C:\Program Files\Company Name\Dir3\dir4” --server=host\Instance --user=username --password=*****’

FWIW those are single-quotes at the beginning and the end. I had issues getting the quotes “right” (still not 100% convinced they’re healthy) but at this point the playbook at least runs (no trip-ups in the YAML parser) but I’m getting this:

“C:\Program is not recognized as in internal or external command…”

If I pull out the second bit with the path (the one for --dbDir=) I can get the .exe to run but I’m missing a required variable so it tanks. I guess I’m screwing up something with the quoting but I can’t figure out what the heck it is. Could anyone give me a pointer or two here?

Thanks!
Matt

Which version of Ansible are you using? There are some fixes in 2.0 that addressed argument quoting and issues with spaces in paths. Due to some other recent issues, I might suggest trying 2.0.0-0.2.alpha2 instead of latest devel.

I’m on 1.9.x right now (whatever is in the yum repo for CentOS 6.6)…the past couple of weeks banging around has lead me to think I may want to go up to 2.x, your advice reinforces that.

That said…I figured it out. I keep forgetting that I’m effectively running everything in Powershell :slight_smile: Basically my call wasn’t valid within PS…as soon as I straightened that out I was fine. That’s 4 hours of my life I won’t get back but it was a heck of a “lesson learned”.

Thanks!