标签:
自动化部署的步骤
1.软件包安装
2.配置文件修改
3.服务启动设置
实际完成apache和mysql的安装配置启动过程:
1.设置/etc/salt/master里面file_roots的目录:
file_roots: base: - /srv/salt/ dev: - /srv/salt/dev/ test: - /srv/salt/test/ prod: - /srv/salt/prod/
2.在/srv/salt/目录下新建dev目录,并且在/srv/salt/dev/目录下新建files目录
3.在/srv/salt/目录下新建top.sls文件
base: ‘*‘: - init.dns dev: ‘*‘: - lamp #表示lamp.sls文件在/srv/salt/dev/目录下
4.在/srv/salt/dev/目录下新建lamp.sls文件
lamp-pkg-install: pkg.installed: - names: - httpd - php - php-cli - php-common - mysql - mysql-server - php-mysql - php-pdo apache-service: file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://files/httpd.conf #base目录/srv/salt/dev - user: root - group: root - mode: 644 service.running: - name: httpd - enable: True mysql-service: file.managed: - name: /etc/my.cnf - source: salt://files/my.cnf #base目录/srv/salt/dev - user: root - group: root - mode: 644 service.running: - name: mysqld - enable: True
5.在/srv/salt/dev/files/目录下,将httpd和mysql的配置文件拷贝到这个目录下,相关配置文件如下:
/etc/httpd/conf/httpd.con
/etc/my.cnf
6.执行重启master命令和分发命令
service salt-master restart #不一定需要这一步 salt ‘*‘ state.highstate
标签:
原文地址:http://www.cnblogs.com/python-study/p/5484895.html