A-A+

使用salt一键批量安装/配置/管理Apache

2014年09月07日 Other Tech 暂无评论 阅读 2,896 次

该文档是使用salt集中安装/配置/管理Tomcat的姊妹文档
但是该文档将之前安装tomcat的各个步骤集中在一个配置文件中进行一键安装配置管理Apache
其他细节不在赘述,具体见:http://www.yallonking.com/?p=1302
Apache的sls配置文件如下:

[root@mysqlhost apache]# cat apache.sls
apache-install:
  file.managed:
    - name: /apache/httpd-2.2.27.tar.gz
    - source: salt://apache/files/httpd-2.2.27.tar.gz
    - user: root
    - group: root
    - mode: 644
  cmd.run:
    - name: cd /apache && tar zxf httpd-2.2.27.tar.gz && cd httpd-2.2.27 && ./configure --prefix=/usr/local/httpd --with-mpm=prefork --enable-so && make && make install
    - unless: test -d /usr/local/httpd
    - require:
      - file: apache-install

apache-service:
  file.managed:
    - name: /apache/add_service.sh
    - source: salt://apache/files/add_service.sh
    - user: root
    - group: root
    - mode: 744
    - backup: minion
  cmd.run:
    - name: /apache/add_service.sh
    - unless: test -f /etc/init.d/Apache
    - require:
      - file: apache-service

apache:
  service.running:
    - name: Apache
    - reload: True
    - watch:
      - file: /usr/local/httpd/conf/httpd.conf
  file.managed:
    - name: /usr/local/httpd/conf/httpd.conf
    - source: salt://apache/files/httpd.conf
    - backup: minion
  cmd.run:
    - name: service Apache restart
    - require:
      - file: apache
标签:

给我留言

Copyright © YallonKing 保留所有权利.   Theme  Ality

用户登录

分享到: