Hi,
I'm trying to install and run a tomcat instance. I followed the example
code at
https://github.com/ansible/ansible-examples/tree/master/tomcat-standalone and
it works fine except for starting tomcat.
My roles/tomcat/tasks/main.yml file ends like this :
Tomcat can sometimes take a while to startup. Can you verify that it takes fewer than 30 seconds to say that it’s ready in catalina.out and port 8080 is available?
Le 24/09/2013 20:42, James Cammarata a �crit :
Tomcat can sometimes take a while to startup. Can you verify that it
takes fewer than 30 seconds to say that it's ready in catalina.out and
port 8080 is available?
It takes a few seconds to start, since there is no webapp to start :
INFO: Server startup in 3623 ms
-- Jean-Philippe Caruana
If this was saying ‘restarted’, I’d suggest possibly using the delay on the wait_for parameter because it might have captured the previous run.
How are you determining that it is running and web accessible in 3.6 seconds?
Le 25/09/2013 14:24, Michael DeHaan a �crit :
If this was saying 'restarted', I'd suggest possibly using the delay on
the wait_for parameter because it might have captured the previous run.
I don't understand.
How are you determining that it is running and web accessible in 3.6
seconds?
THat's what tomcat syas in catalina.out
-- Jean-Philippe Caruana
Yeah typically when that log message appears the server is ready to start handling requests. That makes me wonder if there’s not something else preventing the wait_for from picking up that the port is ready, for instance a firewall with too-restrictive rules maybe? Either that or tomcat is not configured to listen on 127.0.0.1.
Can you do a restart and verify that “telnet localhost 8080” works within 30 seconds?
Le 25/09/2013 17:33, James Cammarata a �crit :
Yeah typically when that log message appears the server is ready to
start handling requests. That makes me wonder if there's not something
else preventing the wait_for from picking up that the port is ready, for
instance a firewall with too-restrictive rules maybe? Either that or
tomcat is not configured to listen on 127.0.0.1.
the problem is not the wait_for, the problem is my "start tomcat task"
doesn't start tomcat
- name: Start Tomcat
service: name=tomcat state=started enabled=yes
--> this doesn't start tomcat at all (therefore wait_for is right), no
process, nothing.
When I do a wait_for and start tomcat by hand (sudo service tomcat
start), then wait_for is ok, says tomcat is started.
(I always launch my playbook with --ask-sudo-pass)
-- Jean-Philippe Caruana
- do you use the distro's stock tomcat or something you rolled out
yourself?
- How do you start tomcat manually?
- Which init script are you using fro starting tomcat?
You might try running the playbook with the option to keep the remote
ansible files, then re-run those manually and try to debug them?
Serge
Le 25/09/2013 20:03, Serge van Ginderachter a �crit :
- do you use the distro's stock tomcat or something you rolled out yourself?
something I rolled out myself, as done in the example playbook
- How do you start tomcat manually?
sudo service tomcat start
- Which init script are you using fro starting tomcat?
a pretty standard one
You might try running the playbook with the option to keep the remote
ansible files, then re-run those manually and try to debug them?
For now, I just ran it on my own box, locally.
-- Jean-Philippe Caruana
Le 26/09/2013 14:25, Michael DeHaan a �crit :
"a pretty standard one"
What does that mean?
It means the standard file (from ansible examples) with a few tweaks
(JDK as a parameter).
-- Jean-Philippe Caruana
The question was about the init script, ansible-examples doesn't carry one
for tomcat AFAIK.
I presume you meant the standard tomcat upstream init script, or the one
provided by your package.
OK, so a problem with running the service module.
I'd recommend running that manually with the test module hacking script,
and debugging the service module script to see what happens.
Le 26/09/2013 15:07, Serge van Ginderachter a �crit :
> "a pretty standard one"
>
> What does that mean?
It means the standard file (from ansible examples) with a few tweaks
(JDK as a parameter).
The question was about the init script, ansible-examples doesn't carry
one for tomcat AFAIK.
I presume you meant the standard tomcat upstream init script, or the one
provided by your package.
It took it from
https://github.com/ansible/ansible-examples/blob/master/tomcat-standalone/roles/tomcat/files/tomcat-initscript.sh
and changed a few things, jdk path for example.
I'd recommend running that manually with the test module hacking script,
and debugging the service module script to see what happens.
"sudo service tomcat start" works fine by itself.
I don't understand with "test module hacking".
-- Jean-Philippe Caruana
How did you install tomcat, and what OS are you running on? If you’re using a packaged version, you shouldn’t need to redo the init script.
Hi everyone, just saw this.
Confession time! I wrote the Tomcat example and for various reasons I
decided to not use the OS packaged version of Tomcat and instead used
an example initscript provided by Apache. I tested it pretty
carefully, though. I will dig in when I have a chance soon and see if
I can reproduce this problem.
-Tim
Hi,
I am experiencing the same issue using this same Ansible example. Perhaps I am also being bitten by the non-standard init script issue. My behavior is exactly like Jean-Philippe’s: I can start the Tomcat server fine if I log into the host and run /etc/init.d/tomcat start, but no matter of Ansible scripting will start it remotely for some reason.
I have confirmed that after a package installation of “tomcat6.noarch” via yum works as expected with the service init script /etc/init.d/tomcat6. If I shut it down on the host and run a simple playbook from my master to start it and wait, everything completes successfully.
Any ideas why the example init script Tim wrote would behave this way, that is, run fine from the command line and not from a playbook?
Thanks
Albion
I can start the Tomcat server fine if I log into the host and run /etc/init.d/tomcat start, but no matter of Ansible scripting will start it remotely for some reason.
I had this same issue on CentOS 5.9 and Oracle Linux 5.9.Changing the start tomcat task from started to restarted in the roles/tomcat/tasks/main.yml file seemed make the problem go away.
- name: Start Tomcat
service: name=tomcat state=restarted enabled=yes
I haven’t been able to figure out why though the init.d start up script looks good to me.
I see this was fixed by pull request, so thanks!