木偶:确保文件为空


15

我想确保motd文件为空。我想这样做:

file { "/etc/motd":
  ensure => empty
}

这显然行不通。

有没有一种简单的方法来确保文件为空,而不是使用“源”声明并将空文件存储在文件存储库中?

Answers:


33

这应该可以正常工作,以确保文件确实存在并且不包含任何内容:

file { '/etc/motd':
  ensure => present,
  content => '',
}
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.