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?