Issue while Passing path values from loop to win_command

8 views
Skip to first unread message

Asha Omanakuttan

unread,
Jul 22, 2019, 8:47:09 AM7/22/19
to Ansible Project

Due to backslash being added or removed win_command is not working as expected. It works fine when I pass the path in a variable.

- name: List the user details
  win_command: '{{full_cmd}} {{cmd1}}'

Variables are as below:

full_cmd: some command
cmd1: Path="D:\\Program Files\\somepath"

cmd from Output:

"cmd": "some command Path=\"D:\\\\Program Files\\\\somepath\"",

But I want to pass it via a loop. Path is a list obtained via set_fact and list. Here it doesn't work as backslashes are not there as above.

win_command: '{{command}}"{{item}}" {{cmd2}}'   
with_items: "{{path}}"

cmd from Output is:

"cmd": "some command Path=\"D:\\Program Files\\somepath\"",
"item": "D:\\Program Files\\somepath",

Please suggest what is wrong here.

Reply all
Reply to author
Forward
0 new messages