cof*_*der 19 service nginx salt-stack
我想在/etc/nginx/conf.d创建或修改目录中的任何文件时重新启动nginx服务.
该目录中有许多文件,而不是指定特定文件,我想观察所有更改.
我试过这个:
nginx:
pkg.installed:
- name: nginx
service:
- running
- enable: True
- restart: True
- watch:
- file: /etc/nginx/nginx.conf
- file: /etc/nginx/conf.d
- pkg: nginx
Run Code Online (Sandbox Code Playgroud)
但这条线- file: /etc/nginx/conf.d并没有做我想要的.
这是错误:
ID: nginx
Function: service.running
Result: False
Comment: The following requisites were not found:
watch:
file: /etc/nginx/conf.d
Changes:
Run Code Online (Sandbox Code Playgroud)
我也尝试了许多变化,包括尾部斜线,但它们都不起作用.
应该- file: /etc/nginx/conf.d/改变什么?
nma*_*hok 23
我正在使用glob进行匹配:
file: /etc/nginx/conf.d/*
Run Code Online (Sandbox Code Playgroud)
这是纠正的片段:
nginx:
pkg.installed:
- name: nginx
service:
- running
- enable: True
- restart: True
- watch:
- file: /etc/nginx/nginx.conf
- file: /etc/nginx/conf.d/*
- pkg: nginx
Run Code Online (Sandbox Code Playgroud)
另请注意,salt只能监视已在状态文件中指定的其他状态,因此它只会监视由salt本身管理的文件.
如果这对您不起作用,请尝试引用以下链接以获取其他解决方案:http: //intothesaltmine.org/blog/html/2012/12/18/using_watch_with_file_recurse.html
| 归档时间: |
|
| 查看次数: |
12580 次 |
| 最近记录: |