win_lineinfile invalid Path argument

19 views
Skip to first unread message

bit conneeect

unread,
Mar 20, 2019, 11:49:14 AM3/20/19
to Ansible Project
Hello everyone,

I am trying to change specific lines of an xml file which is located on J:\ on a windows machine.
Due to the fact that the win_xml module is only able to add but not override strings, I chose the win_linefile module to do so.
This is the task I am deploying:
- name: overwrite xml
win_lineinfile:
path: J:\settings_test.xml
regexp: '<\/url>\s*<snapshots>\s*<enabled>true<\/enabled>\s*<\/snapshots>'
line: '<othertag>\n<othertag>'
The error I get is: msg": "Get-AnsibleParam: Parameter 'path' has an invalid path 'J:\\settings_test.xml' specified."
I allready tried to use / instead of \, use single quotes and also double quotes + escaping. But nothing worked for me.
Is there anything I am missing? Thanks in advance, I appreciate any help!

Kind Regards

CORLEONE##

unread,
Mar 20, 2019, 1:02:14 PM3/20/19
to ansible...@googlegroups.com
Hello, did u check ur host?..
Also u can check if path is configured  correctly but putting a txt or conf file in the same directory  as ur xml one(since i worked with txt nd conf file only using lineinfile )and running the same task on that file.If that works fine it means its failing on xml..some people complained  that lineinfile somehow  changed the file format...U can try using template module..
hope that might help.
Regards 

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/403c0fc2-bc41-4ea7-8fab-4cae33d47c48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages