[ACCEPTED]-SaltStack: In a watch statement, how do I specify a directory where all files should be watched?-salt-stack

Accepted answer
Score: 24

I'm using a glob for matching:

file: /etc/nginx/conf.d/*

Here's the 7 corrected snippet:

nginx:
  pkg.installed:
    - name: nginx
  service:
    - running
    - enable: True
    - restart: True
    - watch:
      - file: /etc/nginx/nginx.conf
      - file: /etc/nginx/conf.d/*
      - pkg: nginx

Also do note that salt 6 can only watch other states that are already 5 specified in your state file, so it will 4 only watch files that are managed by salt 3 itself.

If this doesn't work for you, then 2 try to refer the following link for a different 1 solution: http://intothesaltmine.org/blog/html/2012/12/18/using_watch_with_file_recurse.html

Score: 2

According to issue 663 closed in February 2012, a 1 watch on /path/* should watch recursively.

More Related questions