I am trying to setup Ansible playbook for tomcat application deployment. Apart from starting tomcat everything works without any issues. When i use startup.sh it works but i
The built-in Tomcat management scripts don't detach from the tty, which causes them to be killed when the Ansible ssh session ends. You need to either hack the script to cause it to be backgrounded/detached, or write and install a proper init/systemd script (or crib from any of the numerous examples out there) for Tomcat. For example, here or here or here...
If you want a quick solution to run tomcat server unattached from Ansible's TTY use the following:
- name: "Starting Apache server"
command: nohup {{ apache_install_location }}/tomcat9/bin/startup.sh