SaltStack:监视目录是否有任何更改似乎不适用于自定义模块

问题描述

我正在管理rsyslog证书,以将日志从目录/ opt / certs发送到远程服务器。我有一个自定义模块,用于获取证书并将其存储在此目录中。每当我运行此状态时,都会出现错误:

         ID: rsyslog.service
    Function: service.running
        Name: rsyslog
      Result: False
     Comment: The following requisites were not found:
                                 watch:
                                     file: /opt/certs/*
     Started: 05:15:48.119573
    Duration: 0.004 ms
     Changes:

我的状态文件设置如下:

certs.dir:
  file.directory:
    - name: /opt/certs
    - user: root
    - group: root
    - dir_mode: 700
    - file_mode: 600
    - recurse:
      - user
      - group
      - mode

custom.cert:
  module.run:
   - secrets.get:
     - region: {{ pillar['rsyslog']['cert_region'] }}
     - secret_id: {{ pillar['rsyslog']['cert'] }}
     - file: /opt/cert/ca.crt

rsyslog.service:
  service.running:
    - name: rsyslog
    - enable: True
    - restart: True
    - watch:
      - file: /opt/certs/*

我期望由于将文件写入/ opt / certs中,因此rsyslog应该重新启动。但是我怀疑这是我的自定义模块,但是我不确定。

  1. 我是否需要在模块中做一些事情以使其知道此位置已受管理?
  2. 如果我定义了file.directory资源,为什么会得到找不到必需项的错误?
  3. 我不明白如何使用手表吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...