How to hot deploy to Tomcat with Ansible Currently I build my app with maven and use the tomcat manager to hot deploy the war file (both on windows servers).

Now I want to use ansible to move away from the manual process.


Would it make sense to build with ansible? My assumption is, that it does not.
How could I use the tomcat manager to hot deploy, triggered by ansible. I have searched the web but I did not find a solution.
Is there an other option to hot deploy the war file, which I might have overseen?
At the bottom line I found this method as stable and reliable, in case you want to deploy via ansible.

### This play deploys a webapp war to an tomcat server

- name: Copy the war file {{ webapp_name }}.war as {{ webapp_name }}.war.tmp to {{ webapp_destination_folder }}
  win_copy:
    src: files/{{ webapp_name }}.war
    dest: "{{ webapp_destination_folder }}\\{{ webapp_name }}.war.tmp"
    force: yes 

- name: Remove current war file {{ webapp_destination_folder }}\{{ webapp_name }}.war
  win_file:
    path: "{{ webapp_destination_folder }}\\{{ webapp_name }}.war"
    state: absent

- name: Wait until the webapp folder {{ webapp_destination_folder }}\{{ webapp_name }} is deleted
  win_wait_for:
    path: "{{ webapp_destination_folder }}\\{{ webapp_name }}xxx"
    state: absent
  register: folder_info

- name: rename the {{ webapp_name }}.war.tmp to {{ webapp_name }}.war
  win_command: "cmd.exe /c rename {{ webapp_destination_folder }}\\{{ webapp_name }}.war.tmp {{ webapp_name }}.war"
  register: cmd_result