saltstack的部署安装[二]
# vim /srv/salt/base/web/lamp.slslamp-install: > pkg.installed: 方法
- pkgs: 模块。pkg指定需要安装的包
- httpd
- php
- php-pdo
- php-mysql
apache-config:
file.managed: 文件模块
- name: /etc/httpd/conf/httpd.conf 目的路径
- source: salt://web/files/httpd.conf 源路径,用salt指定配置文件存放的路径
- user: root
- group: root
- mode: 644
- watch_in: 被监控
- service: lamp-service
apache-conf:
file.recurse: 递归
- name: /etc/httpd/conf.d
- source: salt://web/files/apache-conf.d
- watch_in:
- service: lamp-service
apache-auth:
pkg.installed:
- name: httpd-tools
- require_in: require_in我被某个状态依赖。 require我依赖某个状态
- cmd: apache-auth
cmd.run:
- name: htpasswd -bc /etc/httpd/conf/htpasswd_file admin admin
- unless: test -f /etc/httpd/conf/htpasswd_file unless如果条件为真,就是0 那么cmd.run不执行
- watch_in:
- service: lamp-service
/etc/php.ini: > file.managed:
- source: salt://web/files/php.ini
- user: root
- group: root
- mode:644
- watch_in:
- service: lamp-service
lamp-service:
service.running: service.dead关闭服务
- name: httpd
- enable: True 开机自启动,disable
-> - watch: watch我关注某个状态,watch_in我被某个状态关注
- pkg: lamp-install
- pkg: apache-auth
- file: apache-config
- file: apache-conf
页:
[1]