Saltstack Exercise 1-Installing the JDK+TOMCAT environment

Source: Internet
Author: User

Through the previous study, can only say to Saltstack have some simple understanding. Combined with the work environment, test the next batch deployment

Installed a few source packages, and the environment variables are batch modified, here in fact, each parameter is not particularly proficient, slowly divert

Jdk+apr+apr-util+tomcat


Saltstack environment for Master and two sets of minion

Path is/srv/salt/prod/

├──apr

│├──files

││└──apr-1.5.1.tar.bz2

│└──install.sls

├──apr-util

│├──files

││└──apr-util-1.5.4.tar.bz2

│└──install.sls

├──java

│├──files

││└──jdk-7u55-linux-x64.tar.gz

│├──install.sls

│└──profile.sls

├──tomcat

│├──files

││└──apache-tomcat-7.0.52.tar.gz

│└──install.sls

└──top.sls

-----------------------------------------------------------------------------

Entry file, Top.sls

Prod: ' minion* ':-Java.install-java.profile-apr.install-apr-util.install-tomcat.install

The portal file actually does not have much doubt, the first behavior environment, the second line is to which minion to deploy, later said-Java.install means uses the Java folder Install.sls file

-----------------------------------------------------------------------------

Each of the following software we are in the top order to explain one by one, the basic is similar

Cat Java/install.sls

Java-source-install:file.managed:-Name:/opt/soft/jdk-7u55-linux-x64.tar.gz-source:salt://java/files/jdk-7u55  -linux-x64.tar.gz-user:root-group:root-mode:644 Cmd.run:-Name:cd/opt/soft && TAR-ZXVF jdk-7u55-linux-x64.tar.gz && mv jdk1.7.0_55/opt && cd/opt && ln-s jdk1.7.0_55 java-unles s:test-d/opt/java-require:-File:profile-file:java-source-install

Cat Java/profile.sls

Profile:file.append:-Name:/etc/profile-text:-Export java_home=/opt/java-export path= $JAVA _home/ Bin: $PATH-export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar-export ld_library_path= $LD _libra Ry_path:/opt/apr/lib

Java folder has these two files, install is to manage the JDK package and installation files, profile is to modify the Minion end profile

The first line of the Install.sls file is a name (ID) and then use file.managed to version the JDK's source package, then execute cmd.run,-name is the shell command to execute, unless is to determine if there is this/opt/ Java directory, if we have installed this folder exists, then will not be repeated execution, require more important, first determine whether the profile of the SLS file, if executed, then continue to execute Java-source-install


The following are basically similar

Cat Apr/install.sls

include:  - java.installapr-source-install:   file.managed:    - name: /opt/soft/apr-1.5.1.tar.bz2    -  source: salt://apr/files/apr-1.5.1.tar.bz2    - user: root     - group: root    - mode: 644  cmd.run:     - name: cd /opt/soft/ && tar -jxvf  apr-1.5.1.tar.bz2 && cd apr-1.5.1 && ./configure --prefix=/opt/ Apr && make && make install    - unless:  test -d /opt/apr    - require:      -  cmd: java-source-install      - file: apr-source-install 

Cat Apr-util/install.sls

include:  - apr.installapr-util-source-install:  file.managed:     - name: /opt/soft/apr-util-1.5.4.tar.bz2    - source: salt:// apr-util/files/apr-util-1.5.4.tar.bz2    - user: root    -  group: root    - mode: 644  cmd.run:     - name: cd /opt/soft && tar -jxvf apr-util-1.5.4.tar.bz2  && cd apr-util-1.5.4 && ./configure --prefix=/opt/apr-util  --with-apr=/opt/apr && make && make install     - unless: test -d /opt/apr-util    - require:       - cmd: apr-source-install      - file:  apr-util-source-install

Cat Tomcat/install.sls

include:  - apr-util.installtomcat-source-install:  file.managed:     - name: /opt/soft/apache-tomcat-7.0.52.tar.gz    - source: salt ://tomcat/files/apache-tomcat-7.0.52.tar.gz    - user: root     - group: root    - mode: 644  cmd.run:     - name: cd /opt/soft && tar -zxvf  apache-tomcat-7.0.52.tar.gz && mv apache-tomcat-7.0.52 /opt &&  Cd /opt && ln -s apache-tomcat-7.0.52 tomcat && cd  /opt/tomcat/bin && tar -zxvf tomcat-native.tar.gz && cd  tomcat-native-1.1.29-src/jni/native && ./configure --prefix=/opt/apr -- with-apr=/opt/apr --with-java-home=/opt/java --with-ssl=yes && make && make install && source  /etc/profile    - unless: test -d /opt/tomcat     - require:      - cmd: apr-util-source-install       - file: tomcat-source-install

The next include, because require judged there might be two SLS not within a folder, all need to introduce


Test with the following command

Salt ' minion* ' state.highstate test=true


After the test is successful, it can be deployed.

Salt ' minion* ' state.highstate


This test only completes the simple batch deployment installation work, does not introduce the pillar grains and so on according to the different situation to deploy

This article from "Eight Miles" blog, declined reprint!

Saltstack Exercise 1-Installing the JDK+TOMCAT environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.