Windows Escape Character Issue

Good day,

I’m utilizing slurp to pull an XML file from a remote Windows host to lookup some values. In the file there are a couple of Windows paths that when grabbed via regex_search are returned with various escape sequences. For example, \a becomes \u0007.

Any ideas how I can resolve the below? I cannot install anything on the remote host, and I cannot pull files locally. This rules out using any of the XML modules.

Example for clarity:

file.xml:

<?xml version="1.0" encoding="utf-8"?> ... \\somewhere.com\adata\aclusters\bytes ...

Task:

  • name: Create dictionary of values from test.xml
    ansible.builtin.set_fact:
    file_xml_data: ‘{{ file_xml_data | default({}) | combine({item.key: item.value}) }}’
    loop:
  • “{ ‘key’: ‘cifs_share’, ‘value’:
    ‘{{ file_xml | regex_search(’(.+)</‘, ‘\1’) | first }}’ }”

Appreciate any ideas you may have.

Thank you.

Hii

Correct. The control node is an Ansible Tower server that we have limited access to.

That indeed does not leave much.
I'm not sure but the problem may be that you're using the quoted json
style to define your list of key/values.
If I lay that out as basic yaml (same data structure, but a bit
cleaner to look at), it does seem to work for me:

Thank you. I’ll give this a whirl next week.