如果存在特定文件就不执行,例如不存在/etc/nginx目录就安装nginx:
nginx:
pkg:
- name: nginx
- installed
- unless: test -d /etc/nginx
只有存在特定文件才执行,如存在/etc/init.d/httpd就删除httpd:
httpd:
pkg:
- name: httpd
- removed
- onlyif: test -f /etc/init.d/httpd
标签:salt