标签:
require依赖
lamp-pkg-install: pkg.installed: - names: - php - php-cli - php-common - mysql - php-mysql - php-pdo apache-service: pkg.installed: - name: httpd file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://files/httpd.conf - user: root - group: root - mode: 644 - require: - pkg: apache-service #文件管理依赖于pkg包的安装 service.running: - name: httpd - enable: True mysql-service: pkg.installed: - name: mysql-server file.managed: - name: /etc/my.cnf - source: salt://files/my.cnf - user: root - group: root - mode: 644 service.running: - name: mysqld - enable: True
require_in依赖
lamp-pkg-install: pkg.installed: - names: - php - php-cli - php-common - mysql - php-mysql - php-pdo apache-service: pkg.installed: - name: httpd file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://files/httpd.conf - user: root - group: root - mode: 644 - require: - pkg: apache-service service.running: - name: httpd - enable: True mysql-service: pkg.installed: - name: mysql-server - require_in: -file: mysql-service #pkg这个包需要被文件管理模块所使用 file.managed: - name: /etc/my.cnf - source: salt://files/my.cnf - user: root - group: root - mode: 644 service.running: - name: mysqld - enable: True
watch依赖
lamp-pkg-install: pkg.installed: - names: - php - php-cli - php-common - mysql - php-mysql - php-pdo apache-service: pkg.installed: - name: httpd file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://files/httpd.conf - user: root - group: root - mode: 644 - require: - pkg: apache-service service.running: - name: httpd - enable: True - reload: True - watch: - file: apache-service #每当file的文件修改,服务重新reload mysql-service: pkg.installed: - name: mysql-server - require_in: - file: mysql-service file.managed: - name: /etc/my.cnf - source: salt://files/my.cnf - user: root - group: root - mode: 644 service.running: - name: mysqld - enable: True
watch_in依赖
lamp-pkg-install: pkg.installed: - names: - php - php-cli - php-common - mysql - php-mysql - php-pdo apache-service: pkg.installed: - name: httpd file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://files/httpd.conf - user: root - group: root - mode: 644 - require: - pkg: apache-service service.running: - name: httpd - enable: True - reload: True - watch: - file: apache-service mysql-service: pkg.installed: - name: mysql-server - require_in: - file: mysql-service file.managed: - name: /etc/my.cnf - source: salt://files/my.cnf - user: root - group: root - mode: 644 - watch_in: - service: mysql-service #文件file被watch_in监控,编辑后重启 service.running: - name: mysqld - enable: True
watch_in也可以用于监控软件包的变化,如果安装的软件包有版本更新,也会导致服务的相应动作。
lamp-pkg-install: pkg.installed: - names: - php - php-cli - php-common - mysql - php-mysql - php-pdo apache-service: pkg.installed: - name: httpd - watch_in: - service: apache-service file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://files/httpd.conf - user: root - group: root - mode: 644 - require: - pkg: apache-service service.running: - name: httpd - enable: True - reload: True - watch: - file: apache-service mysql-service: pkg.installed: - name: mysql-server - require_in: - file: mysql-service file.managed: - name: /etc/my.cnf - source: salt://files/my.cnf - user: root - group: root - mode: 644 - watch_in: - service: mysql-service service.running: - name: mysqld - enable: True
标签:
原文地址:http://www.cnblogs.com/python-study/p/5486492.html