On Tue, 6 Nov 2018 at 14:23, Léo-San <
speculu...@gmail.com> wrote:
>
> Hey everyone,
>
> so, I am trying to upload an xml template with the uri module, but I cannot find a way which is working. Mostly I am getting the error "Error in XML file. Possible mismatch between resource specified in the URL and XML file", but the curl command is working with that file.
Are you sure?
What file did you upload with curl?
Because your task specifies a templated file.
Could it be that the templating has gone wrong in the sense that it
works for Jinja, but the resulting output isn't valid XML?
What happens if you skip the template step, i.e. upload a valid XML
file, i.e. the one that works with curl, but then with ansible?
So instead of:
src: "{{ lookup('template', 'dp_.xml') }}"
just do:
src: /path/to/file/that/works/with/curl.xml
?
If you are going to construct XML, you may want to consider using the
xml module:
https://docs.ansible.com/ansible/latest/modules/xml_module.html
Dick