Semka Mesilov
Semka Mesilov

Reputation: 57

ansible duplicates slashes in windows file path

Trying to test simple ansible script I defined a variable.

variable: C:\Log\1.txt

Next I simply try to echo this variable.

-name: echo
  debug: msg="{{ variable }}"

Got:

 "msg": "C:\\Log\\1.txt"

Expected output:

"msg": "C:\Log\1.txt"

How can I get one slash in path output?

Thanks.

Upvotes: 2

Views: 4639

Answers (1)

Konstantin Suvorov
Konstantin Suvorov

Reputation: 68289

Don't be confused by the fact that ansible-playbook prints debug messages in JSON encoded form, so some characters are escaped.
There's no duplicated slashes in the variable's value.

See my answer for different question for details: https://stackoverflow.com/a/39587120/2795592

Upvotes: 4

Related Questions