# Tomcat service stops fine and fails to start. Ansible shows success for both.

**URL:** <https://forum.ansible.com/t/tomcat-service-stops-fine-and-fails-to-start-ansible-shows-success-for-both/21790>\
**Category:** Ansible Project\
**Created:** [June 16, 2016, 11:15am UTC](https://forum.ansible.com/t/tomcat-service-stops-fine-and-fails-to-start-ansible-shows-success-for-both/21790 "2016-06-16T11:15:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kannan\_AnandaKrishna](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@Kannan\_AnandaKrishna](https://forum.ansible.com/u/Kannan_AnandaKrishna)\
**Post date:** [June 16, 2016, 11:15am UTC](https://forum.ansible.com/t/tomcat-service-stops-fine-and-fails-to-start-ansible-shows-success-for-both/21790/1 "2016-06-16T11:15:11Z")

</div>

Hello,

I’m using Ansible in our environment to restart glassfish applications, services etc.,

Currently I’m facing curious issue on restarting tomcat service in our servers.

Whenever I execute the stop script, the tomcat service is stopped successfully but while trying to start the output shows success, the service is still down in the server.

Commands:

[automatrix@t1cogpcop01 ~]$ ansible m10 -m shell -a ‘sudo su - mstrsvc /app/tomcat/bin/shutdown.sh’ -vvv

> **m10 is the group name of the server. automatrix account has sudo access to “mstrsvc” account in remote server and tomcat service should be stopped/started from mstrsvc only.**

ESTABLISH CONNECTION FOR USER: automatrix

REMOTE\_MODULE command sudo su - mstrsvc /app/tomcat/bin/shutdown.sh #USE\_SHELL

EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/automatrix/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/home/automatrix/.ssh/id\_rsa” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=1 ASHADOLMCR-S02 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1466073513.08-167794820776673 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1466073513.08-167794820776673 && echo $HOME/.ansible/tmp/ansible-tmp-1466073513.08-167794820776673’

PUT /tmp/tmpKgCn4g TO /home/automatrix/.ansible/tmp/ansible-tmp-1466073513.08-167794820776673/command

EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/automatrix/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/home/automatrix/.ssh/id\_rsa” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=1 ASHADOLMCR-S02 /bin/sh -c ‘LANG=C LC\_CTYPE=C /usr/bin/python /home/automatrix/.ansible/tmp/ansible-tmp-1466073513.08-167794820776673/command; rm -rf /home/automatrix/.ansible/tmp/ansible-tmp-1466073513.08-167794820776673/ \>/dev/null 2\>&1’

ASHADOLMCR-S02 | success | rc=0 \>\>  
Using CATALINA\_BASE: /app/tomcat  
Using CATALINA\_HOME: /app/tomcat  
Using CATALINA\_TMPDIR: /app/tomcat/temp  
Using JRE\_HOME: /usr/jdk/jdk1.7.0\_07  
Using CLASSPATH: /app/tomcat/bin/bootstrap.jar  
Using CATALINA\_PID: /app/tomcat/catalina.pid

Startup:

[automatrix@t1cogpjra01 ~]$ ansible m10 -m shell -a “sudo su - mstrsvc /app/tomcat/bin/startup.sh” -vvv

[WARNING]: The version of gmp you have installed has a known issue regarding  
timing vulnerabilities when used with pycrypto. If possible, you should update  
it (i.e. yum update gmp).

ESTABLISH CONNECTION FOR USER: automatrix

REMOTE\_MODULE command sudo su - mstrsvc /app/tomcat/bin/startup.sh #USE\_SHELL

EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/automatrix/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/home/automatrix/.ssh/id\_rsa” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=1 ASHADOLMCR-S02 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1466073302.56-93703916239176 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1466073302.56-93703916239176 && echo $HOME/.ansible/tmp/ansible-tmp-1466073302.56-93703916239176’

PUT /tmp/tmprJ4Yvq TO /home/automatrix/.ansible/tmp/ansible-tmp-1466073302.56-93703916239176/command

EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/automatrix/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“/home/automatrix/.ssh/id\_rsa” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=1 ASHADOLMCR-S02 /bin/sh -c ‘LANG=C LC\_CTYPE=C /usr/bin/python /home/automatrix/.ansible/tmp/ansible-tmp-1466073302.56-93703916239176/command; rm -rf /home/automatrix/.ansible/tmp/ansible-tmp-1466073302.56-93703916239176/ \>/dev/null 2\>&1’

ASHADOLMCR-S02 | success | rc=0 \>\>  
Using CATALINA\_BASE: /app/tomcat  
Using CATALINA\_HOME: /app/tomcat  
Using CATALINA\_TMPDIR: /app/tomcat/temp  
Using JRE\_HOME: /usr/jdk/jdk1.7.0\_07  
Using CLASSPATH: /app/tomcat/bin/bootstrap.jar  
Using CATALINA\_PID: /app/tomcat/catalina.pid  
Existing PID file found during start.  
Removing/clearing stale PID file.

Though it shows success, the service isn’t started in the server and the mystery no logs found in tomcat logs when we attempt to start the service, whereas stop attempt are clearly captured.

If I execute the same shell arguments directly in the server, it works fine. What could be the issue while executing the startup script?
