如何在Ansible上运行Tomcat Catalina脚本 [英] How to run tomcat catalina script on Ansible

查看:142
本文介绍了如何在Ansible上运行Tomcat Catalina脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Tomcat应用程序部署设置Ansible剧本.除了启动tomcat之外,其他所有功能都可以正常工作.当我使用startup.sh时,它可以工作,但是我需要使用catalina.sh脚本启动tomcat.

I am trying to setup Ansible playbook for tomcat application deployment. Apart from starting tomcat everything works without any issues. When i use startup.sh it works but i need to start tomcat with catalina.sh script.

   - name: start tomcat
     command: ./bin/catalina.sh start
     args:
       chdir: /websrv/tomcat/tomcat-8080/

这是我正在尝试做的事情,它说开始了,但是从来没有开始.

This is what i am trying to do, it says started but it was never started.

TASK [start tomcat] ************************************************************
changed: [appserver.example.com]

请帮助.

注意:我在centos上使用tomcat的压缩版本,但尚未安装tomcat.因此,如果有人对如何启动脚本有所了解,将非常有帮助.

Note: I am using zipped version of tomcat on centos and have not installed tomcat. So if anyone shed light on how to start the script it would be really helpful.

推荐答案

内置的Tomcat管理脚本不会与tty分离,这会导致它们在Ansible ssh会话结束时被杀死.您需要破解脚本以使其后台/分离,或者为Tomcat编写并安装适当的init/systemd脚本(或众多示例中的任何一个).例如,在此处此处

The built-in Tomcat management scripts don't detach from the tty, which causes them to be killed when the Ansible ssh session ends. You need to either hack the script to cause it to be backgrounded/detached, or write and install a proper init/systemd script (or crib from any of the numerous examples out there) for Tomcat. For example, here or here or here...

这篇关于如何在Ansible上运行Tomcat Catalina脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆