I'm not seeing the behaviour you describe - maybe my playbook isn't doing the same things as yours though?
# playbook:
$ cat trondpath.yml
---
- name: test trond observed strange path behaviour
hosts: TENSY
vars:
logfiles_path: "F:\\Logs"
connection: winrm
gather_facts: false
tasks:
- name: create json file from template
win_template:
src: template.json
dest: templated.json
# template file:
$ cat template.json
{
"FilePath":"{{ logfiles_path }}\\*",
"Stuff": otherstuff
}
contents of templated.json:
{
"FilePath":"F:\Logs\\*",
"Stuff": otherstuff
}
I'm using ansible 2.3 (Win 10 WSL / Ubuntu )
Dag is right though we should document this - I've put it on my list. Better still would be to document and make some kind of automated test like the integration tests for modules. There are probably quite a few possible combinations to work through - absolute and relative paths, paths to files, paths to dirs and then all the places you can define them - hostvars, group vars, included vars, in-playbook vars, hardcoded in playbooks, hardcoded in templates, and inside {{ }}
For info there are filters for windows style paths.
See
http://docs.ansible.com/ansible/playbooks_filters.html win_basename, win_splitdrive and win_dirname are the windows-specific ones.
Another trick you can use is to use unix style path separators - powershell is *usually* ok with this but obviously it depends on what is happening in your powershell code - if you pass a path to a native windows binary in your powershell (or ansible module code) obviously this isn't going to work.
Hope this helps,
Jon