Ansible 2.0 parameter escaping problem

133 views
Skip to first unread message

Rob White

unread,
Jan 20, 2016, 1:39:45 AM1/20/16
to Ansible Project
I've starting seeing the following problem since I upgraded to Ansible v2.0

Here's the task:

raw:

 PowerShell "C:\Temp\db_scripts\copy_db_file.ps1" \"{{ system_db_default_location }}/master.mdf\" \"{{ system_db_master_mdf_location }}/master.mdf\"


It used to work fine in Ansible 1.9 but now I get a PowerShell error:

"stderr": "The string is missing the terminator: \".\r\n    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordEx \r\n   ception\r\n    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString\r\n \r\n"



This is obviously something to do with the way Ansible has changed how it handles escaped characters but I've tried a number of other different options for escaping my task and i can't get it to work.


I appreciate any suggestions.

Rob White

unread,
Jan 21, 2016, 2:33:31 AM1/21/16
to Ansible Project
After much base64 decoding of Powershell commands the following will work:

raw:

  C:\Temp\db_scripts\copy_db_file.ps1 "{{ system_db_default_location }}/master.mdf" "{{ system_db_master_mdf_location }}/master.mdf"


I removed the PowerShell call at the beginning, unquoted the script path and then removed the escaping slash \ before the quotation marks around the arguments.

Hopefully this will help somebody!

Reply all
Reply to author
Forward
0 new messages