0

Before I start tomcat I'm manually remove the deployed unpacked folder /app/tomcat/webapps/myapp inorder to clear caching issues.

I have the /app/tomcat/webapps/myapp.war which is auto-deployed and i get folder /app/tomcat/webapps/myapp created when started manually as below.

cd /app/tomcat/bin
./starttomcat.sh

The auto deploy does not work i.e. folder /app/tomcat/webapps/myapp is not created when i start tomcat through ansible automation as below:

---
- name: This is a tomcat start
  hosts: localhost
  tasks:
    - shell: "/app/tomcat/bin/starttomcat.sh"

Below is the setting in the server.xml of tomcat

grep webapps /app/tomcat/conf/server.xml

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

Can you please suggest how can i enforce myapp.war deployment even if the myapp.war is not a new one?

Ashar
  • 2,942
  • 10
  • 58
  • 122
  • 1
    This specific question [comes up a lot](https://stackoverflow.com/search?q=%5Bansible%5D+tomcat+shell) and the answer is almost always "use `nohup`", or the more enlightened "use [`systemd:`](https://docs.ansible.com/ansible/6/collections/ansible/builtin/systemd_module.html)" because even with nohup, which will get you past your current hurdle, it does not **keep** tomcat running in the way an actual service would – mdaniel Aug 29 '22 at 19:08
  • Are the user accounts different? When you start manually, you might have write access to the webapps directory, which the ansible user might not have. E.g. who owns webapps, what are the permission bits? (Follow up: check the same for temp and work directories) – Olaf Kock Aug 29 '22 at 19:45
  • @OlafKock the user is the same and alike. i tried this and it worked ->` - shell: "cd /app/tomcat/bin/; ./starttomcat.sh"` – Ashar Aug 29 '22 at 19:48

0 Answers0