salt总结

安装jdk

jdk:
  file.managed:
   - source: salt://service/zabbix/files/jdk1.8.0_121.tar.gz
   - name: /usr/local/jdk1.8.0_121.tar.gz
   - mode: 644
   - uid: root
   - gid: root

jdk_install:
  cmd.run:
    - name: cd /usr/local && tar xf jdk1.8.0_121.tar.gz


/etc/profile:
  file.append:
   - name: /etc/profile
   - text:
       - export JAVA_HOME=/usr/local/jdk1.8.0_121
       - export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
       - export PATH=$PATH:$JAVA_HOME/bin

 编译安装nginx

nginx-install.sls

include:
  - service.nginx.nginx-pre

nginx:
  user.present:
    - shell: /sbin/nologin
    - gid_from_name: True
    - createhome: false

nginx-source-install:
  file.managed:
   - name: /tmp/nginx-1.10.3.tar.gz
   - source: salt://service/nginx/files/nginx-1.10.3.tar.gz
  cmd.run:
   - name: cd /tmp && tar xf nginx-1.10.3.tar.gz && cd nginx-1.10.3 && ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-cc-opt=-O3 --with-stream && make && make install
   - unless: test -d /tmp/nginx-1.10.3.tar.gz
   - creates: /usr/local/nginx

nginx-conf-file:
  file.managed:
    - name: /usr/local/nginx/conf/nginx.conf
    - source: salt://service/nginx/files/nginx.conf
    - mode: 644
    - template: jinja
    - defaults:
      num_cpus: {{ grains['num_cpus'] }}
~                                                   

 nginx-pre.sls

pkg-init:
  pkg.installed:
    - pkgs:
      - gcc
      - gcc-c++
      - zlib-devel
      - openssl-devel
      - openssl
      - pcre-devel
      - pcre

 tomcat8-sls

tomcat-install:
  file.managed:
    - name: /tmp/apache-tomcat-8.5.29.tar.gz
    - source: salt://tomcat/files/apache-tomcat-8.5.29.tar.gz
    - user: root
    - group: root
    - mod: 755
  cmd.run:
    - name: tar -xf /tmp/apache-tomcat-8.5.29.tar.gz && mv apache-tomcat-8.5.29 /usr/local/tomcat
    - unless: test -d /usr/local/tomcat
    - require:
      - file: tomcat-install

tomcat-config:
  file.managed:
    - name: /usr/local/tomcat/conf/server.xml
    - source: salt://tomcat/files/server.xml
    - user: root
    - group: root
    - mode: 644
    - template: jinja
    - defaults:
      IPADDR: {{ grains [ 'fqdn_ip4'][0] }}  

 

posted @ 2018-03-26 16:32  梦轻尘  阅读(179)  评论(0编辑  收藏  举报