示例来自: https : //docs.saltstack.com/en/latest/topics/tutorials/states_pt2.html
/etc/httpd/extra/httpd-vhosts.conf: file.managed: - source: salt://webserver/httpd-vhosts.conf apache: pkg.installed: [] service.running: - watch: - file: /etc/httpd/extra/httpd-vhosts.conf - require: - pkg: apache
有没有办法注入“手表”?
我在可选模块中pipe理apache文件。
service.running已经在所有主机上安装的主要部分。
如果可选模块被更改,我怎么能告诉Apache重新启动?
我想在我的盐文件严格分离:主要部分不知道可选模块。
我希望你能理解我。 如果没有,请留下评论。 谢谢。
您可以在想要触发重启的状态下使用watch_in ,而不是在要重启的服务上使用watch 。 这里从我的盐状态片断:
/etc/consul/httpd.json: file.managed: - source: salt://web/conf/httpd.json - watch_in: - service: consul consul: service.running: - enable: True