SaltStack - 用于 Mojave 10.14 的 Touch 和 666 /var/db/ntp-kod

SaltStack - Touch and 666 /var/db/ntp-kod for Mojave 10.14

有点困惑我如何在 Salt 中实现这个请求。

我需要 touch 和 666 /var/db/ntp-kod 文件。我在 10.14。 我们可以通过 file.managed 完成吗?

你们能帮我提供这个请求的完整代码吗?

是的,您可以使用 file.managed。神奇的是设置replace: False。参见 https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.managed

replace: True
    If set to False and the file already exists, the file will not be modified even if changes would otherwise be made. Permissions and ownership will still be enforced, however.

edit: 需要摸一下,就加contents: '',不过不知道你有没有认真看文档页