Just noticed you said windows paths. in playbooks I would suggest the
following
1/ use ansible 2.0 or later
2/ use key: value (yaml style) rather than key=value key=value as you are
less likely to need to quote vars if they aren't all on one line.
3/ If you aren't using templating you can usually just have bare paths
without any quoting
win_copy:
src: myfile.txt
dest: C:\Myfiles\myfile.txt
4/ if you are using templating then you may need to double quote your
windows paths - and if you are double quoting then use double backslash for
path separator
vars:
sub_dir: "parent_folder\\child_folder"
win_copy:
src: myfile.txt
dest: "C:\\Myfiles\\{{ sub_dir }}\\myfile.txt"
It looks like maybe you are trying to use a UNC path to access files from a
second windows machine \\someserver\\share. Unfortunately windows treats
this as a 'second hop' (hop 1 is from ansible controller to windows box,
hop 2 is from windows box to \\second_machine), and 'second hop'
communication is usually disallowed.
If you have pywinrm installed and you set up kerberos delegation you can
get round this limitation, but this is new functionality and not yet
documented. If possible it might be easier to use fetch to collect files
from one windows machine and then win_copy to push the files out to your
windows machines if you don't want to, or can't set up kerberos delegation.
Hope this helps,
Jon
On Tuesday, June 28, 2016 at 11:04:19 PM UTC+1, J Hawkesworth wrote:
>
> Can you give a bit more detail?
>
> Don't forget that as well as python parsing, there is yaml parsing and if
> you are using templates - {{ }} then there is jinja2 parsing too.
>
> So can you share a minimal version of the problem?
>
> Jon
>
> On Tuesday, June 28, 2016 at 9:22:55 PM UTC+1, Karol Olczak wrote:
>>
>> Hi
>>
>> What is the most efficient way to "push" backslashes in ansible playbooks
>> ?
>>
>> My playbook does not work because Python cut backslashes or add new one.
>>
>> e.g. //hostname001/foo/
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/cc90f9b9-18f1-4630-bdff-bbad5aed8924%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.