zoukankan      html  css  js  c++  java
  • salt搭建lamp架构

    install_httpd:
      pkg.installed:
        - name: httpd
    
    
    httpd_running:
      service.running:
        - name: httpd
        - enable: True
        - require:
          - pkg: install_httpd
        - watch:
          - file: httpd_conf
          - file: php_conf
    
    httpd_conf:
      file.managed:
        - name: /etc/httpd/conf/httpd.conf
        - source: salt://httpd.conf
        - user: root
        - group: root
        - mode: 600
    
    install_php:
      pkg.installed:
        - name: php_all
        - pkgs:
          - php
          - php-mysql
          - php-common
          - php-gd
          - php-mbstring
          - php-mcrypt
          - php-devel
          - php-xml
        - require:
          - pkg: install_httpd
    
    
    php_conf:
      file.managed:
        - name: /etc/php.ini
        - source: salt://php.ini
        - user: root
        - group: root
        - mode: 600
    
    install_mysql:
      pkg.installed:
        - name: mysql
        - pkgs:
          - mariadb
          - mariadb-server
          - mariadb-devel
    
    mysql_running:
      service.running:
        - name: mysqld
    
    mysql_conf:
      file.managed:
        - name: /etc/my.cnf
        - source: salt://my.cnf
        - user: root
        - group: root
        - mode: 600
    
    discuz_distribute:
      file.managed:
        - name: /var/www/html/Discuz.zip
        - source: salt://Discuz.zip
    unzip_discuz:
      cmd.run:
        - name: unzip /var/www/html/Discuz.zip

     源码安装haproxy示例:

    haproxy-install:
    file.managed:
    - name: /usr/local/src/haproxy-1.5.3.tar.gz
    - source: salt://haproxy/files/haproxy-1.5.3.tar.gz
    - mode: 755
    - user: root
    - group: root
    cmd.run:
    - name: cd /usr/local/src && tar zxf haproxy-1.5.3.tar.gz && cd haproxy-1.5.3 && make TARGET=linux26 PREFIX=/usr/local/haproxy && make install PREFIX=/usr/local/haproxy
    - unless: test -d /usr/local/haproxy
    - require:
    - file: haproxy-install
    
    /etc/init.d/haproxy:
    file.managed:
    - source: salt://haproxy/files/haproxy.init
    - mode: 755
    - user: root
    - group: root
    - require:
    - cmd: haproxy-install
    
    net.ipv4.ip_nonlocal_bind:
    sysctl.present:
    - value: 1
    
    haproxy-config-dir:
    file.directory:
    - name: /etc/haproxy
    - mode: 755
    - user: root
    - group: root
    
    haproxy-init:
    cmd.run:
    - name: chkconfig --add haproxy
    - unless: chkconfig --list | grep haproxy
    - require:
    - file: /etc/init.d/haproxy
  • 相关阅读:
    Windows下载Vim
    分享:分享几个程序员使用的网站
    分享:C语言大礼包(PDF)
    将vscode打造成强大的C/C++ IDE
    最适合做C/C++开发的IDE
    bzoj 2244
    bzoj 1492
    bzoj 3262
    bzoj 1176
    bzoj 2961
  • 原文地址:https://www.cnblogs.com/uglyliu/p/6365938.html
Copyright © 2011-2022 走看看