SaltStack安装Tomcat
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SaltStack安装Tomcat相关的知识,希望对你有一定的参考价值。
1. 基础环境
[[email protected] ~]# cd /srv/salt/prod/modules [[email protected] modules]# ls haproxy keepalived memcached pcre pkg user jdk libevent nginx php tomcat [[email protected] modules]# mkdir jdk && mkdir tomcat
modules是我存放功能模块的的目录,每个服务尽量能单独写一个状态文件,具有通用性。
2. Installing jdk-8u45-linux-x64
[[email protected] modules]# cd jdk [[email protected] jdk]# mkdir files #存放安装包 [[email protected] jdk]# vim jdk-install.sls #编写安装状态文件 jdk-installl: file.managed: - name: /server/tools/jdk-8u45-linux-x64.tar.gz - source: salt://modules/jdk/files/jdk-8u45-linux-x64.tar.gz - user: root - group: root - mode: 755 cmd.run: - name: cd /server/tools/jdk-8u45-linux-x64.tar.gz && tar zxf jdk-8u45-linux-x64.tar.gz && mv jdk1.8.0_45 /application/jdk && chown -R root:root /application/jdk - unless: test -d /application/jdk - requrie: - file: jdk-install jdk-config: file.append: - name: /etc/profile - text: - export JAVA_HOME=/application/jdk - export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH - export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
上面安装了jdk环境
3. Installing Tomcat
[[email protected] modules]# cd tomcat [[email protected] tomcat]# mkdir files #存放tomcat的安装包 [[email protected] tomcat]# vim install.sls #编写安装状态文件 include: - modules.jdk.install tomcta-install: file.managed: - name: /server/tools/apache-tomcat-8.0.23.tar.gz - source: salt://modules/tomcat/files/apache-tomcat-8.0.23.tar.gz - user: root - group: root - mode: 755 cmd.run: - name: cd /server/tools/ && tar zxf apache-tomcat-8.0.23.tar.gz && mv apache-tomcat-8.0.23 /application/ && ln -s /application/apache-tomcat-8.0.23 /application/tomcat && chown -R root:root /application/tomcat8 - unless: test -d /application/tomcat tomcat-config: file.append: - name: /etc/profile - text: - export TOMCAT_HOME=/application/tomcat
本文出自 “Sunset” 博客,谢绝转载!
以上是关于SaltStack安装Tomcat的主要内容,如果未能解决你的问题,请参考以下文章
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途