Saltstack:目录清理,不包括子目录

时间:2015-07-09 16:22:23

标签: linux salt-stack

所以我在nginx / common / init.sls中有这个:

nginx:
  pkg:
    - latest

/etc/nginx:
  file.directory:
    - user: root
    - group: root
    - mode: 755
    - clean: True
    - require:
      - pkg: nginx

/etc/nginx/conf.d:
  file.recurse:
    - source: salt://nginx/common/files/conf.d
    - user: root
    - group: root
    - clean: True
    - template: jinja
    - recurse:
      - user
      - group
      - mode
    - require_in:
      - file: /etc/nginx

/etc/nginx/vhosts.d:
  file.directory:
    - user: root
    - group: root
    - mode: 755
    - makedirs: True
    - require_in:
      - file: /etc/nginx

保持 / etc / nginx 清除默认配置文件并将我自己的配置播种到此目录和子目录中。当我运行 highstate 时运行正常,但当我使用 test = true 运行 highstate 时,它会返回一个通知:

  ID: /etc/nginx
  Function: file.directory
    Result: None
   Comment: The following files will be changed:
      /etc/nginx/conf.d: removed - Removed due to clean
      /etc/nginx/vhosts.d: removed - Removed due to clean

这很糟糕,因为阻止我监视'干净'的高州,实际上是不真实的。

我尝试在 / etc / nginx 的'requier'中添加子目录,但结果是相同的。我还注意到该问题仅影响 file.directory file.recurse ,而不影响 file.managed 。如何防止错误输出 highstate test = true

0 个答案:

没有答案