I can restart Jetty with no issues form the command line:
sudo /sbin/service jetty restart
log:
2015-11-30 16:33:38.875:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@3567135c{/,[file:///tmp/jetty-localhost-8080-api.war--any-1507380460644118921.dir/webapp/, jar:file:///tmp/jetty-localhost-8080-api.war--any-1507380460644118921.dir/webapp/WEB-INF/lib/myfaces-api-2.2.8.jar!/META-INF/resources],AVAILABLE}{/api.war}
2015-11-30 16:33:38.899:INFO:oejs.ServerConnector:main: Started ServerConnector@12f279b5{HTTP/1.1,[http/1.1]}{localhost:8080}
2015-11-30 16:33:38.899:INFO:oejs.Server:main: Started @9058ms
But I unable to restart using ansible.
Here is my jenkins command to run ansible:
ansible-playbook -c ssh -i stg --extra-vars=“hosts=all” --private-key=~/.ssh/access.key -f 10 jetty-restart.yml
Contents of jetty-restart.yml:
#aritsto-jetty-restart.yml
- hosts: “{{ hosts }}”
remote_user: deployer
tasks:
- name: Check if Service jetty Exists
stat: path=/etc/init.d/jetty
register: service_status
# start jetty using core module
- name: Restart jetty
shell: sudo /sbin/service jetty restart
#service: name=jetty enabled=no state=restarted
when: service_status.stat.exists
ansible log:
– api01.stg.ewr1.nytimes.com: –
cmd: sudo /sbin/service jetty restart
start: 2015-11-30 16:46:10.636655
end: 2015-11-30 16:46:27.828391
delta: 0:00:17.191736
stdout: Stopping Jetty: OK
Starting Jetty: . . OK Mon Nov 30 16:46:26 EST 2015
stderr: 2015-11-30 16:46:15.310:INFO::main: Logging initialized @526ms
2015-11-30 16:46:15.643:INFO::main: Redirecting stderr/stdout to /opt/jetty-distribution-9.3.0.v20150612/logs/2015_11_30.stderrout.log
log:
2015-11-30 16:46:24.101:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@3567135c{/,[file:///tmp/jetty-localhost-8080-api.war--any-4495068837574041021.dir/webapp/, jar:file:///tmp/jetty-localhost-8080-api.war--any-4495068837574041021.dir/webapp/WEB-INF/lib/myfaces-api-2.2.8.jar!/META-INF/resources],AVAILABLE}{/-api.war}
2015-11-30 16:46:24.124:INFO:oejs.ServerConnector:main: Started ServerConnector@5807efad{HTTP/1.1,[http/1.1]}{localhost:8080}
2015-11-30 16:46:24.126:INFO:oejs.Server:main: Started @9342ms
2015-11-30 16:46:27.857:INFO:oejs.ServerConnector:Thread-1: Stopped ServerConnector@5807efad{HTTP/1.1,[http/1.1]}{localhost:8080}
[INFO ][ebApplicationContext] Closing Root WebApplicationContext: startup date [Mon Nov 30 16:46:19 EST 2015]; root of context hierarchy
2015-11-30 16:46:27.899:INFO:oejsh.ContextHandler:Thread-1: Stopped o.e.j.w.WebAppContext@3567135c{/,[file:///tmp/jetty-localhost-8080-api.war--any-4495068837574041021.dir/webapp/, jar:file:///tmp/jetty-localhost-8080-api.war--any-4495068837574041021.dir/webapp/WEB-INF/lib/myfaces-api-2.2.8.jar!/META-INF/resources],UNAVAILABLE}{/api.war}
What is causing the jetty service to stop 3 seconds after an apparent successful restart?