HI.

I've been trying to deploy a war file to the Tomcat manager using the uri 
module.  I've been able to use curl from the command line to achieve this 
but I can't seem to translate it into an ansible task that uses the uri 
module.  I could just use the shell module and insert the curl command I've 
been using but I want to stick to best practices and use a module if one if 
available.

Anyway here's the curl command that works (ran from my workstation):

curl -k -X PUT -u $TOMCAT_USER:$TOMCAT_PW --upload-file someapp.war 
"https://$SERVER:8443/manager/text/deploy?path=/someapp&update=true";


And here's the latest attempt at an ansible task:

- name: Push war to Tomcat manager
  uri:
    url: "https://{{ inventory_hostname 
}}:8443/manager/text/deploy?path=/someapp&update=true"
    src: /opt/someapp.war'
# tried this instead of src
#    
    user: "{{ tomcat_manager_username }}"
    password: "{{ tomcat_manager_password }}"
    force_basic_auth: yes
    method: PUT
  delegate_to: 127.0.0.1


The task passes but it just pushes a blank file to Tomcat instead of the 
war.  I've tried subbing out the src param with

body: "{{ lookup('file', '/opt/someapp.war') }}"


but I get utf-8 encoding errors.   

My main question is uploading a binary file not possible with the URI 
module?  And if so what parameters should I use?  There's documentation for 
using POST with a json file on http://docs.ansible.com/uri_module.html but 
nothing about uploading binaries. 

Thanks in advance.

Ansible version: 1.8.4

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/27bcddaa-5795-4110-8571-4e19c1f5a1d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to