> What file did you upload with curl? When I upload the file with curl where I replaced the variables with what it needs to be later, it works. Also if I just leave the variables inside, it will be just uploaded with the names of the variables. I am just using the "inventory_hostname" and the "inventory_hostname_short" variables.
> 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? The debug test shows that the variables get replaced correctly by ansible. > src: /path/to/file/that/works/with/curl.xml I also tried the path for "src". The same error happened. Also I am sure the XML file is correct like that as I copied an already existing XML from the Server and used it as a template for mine. (Also everything was correct on the Server after uploading the dp_.xml with curl). So I really don't know what could have gone wrong. Am Dienstag, 6. November 2018 16:41:50 UTC+1 schrieb Dick Visser: > > On Tue, 6 Nov 2018 at 14:23, Léo-San <[email protected] <javascript:>> > 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 > -- 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/2c413951-b78a-4eb9-ad20-af960c02eabe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
