我试图创build一个基于模板的文件,但我得到一个错误,无法find模板。
我的目录设置是/ etc / puppet / modules // templates /
在模板下,如果每个主机都有一个目录,再加上一个通用模板。 在主机目录下,我有一个特定于该主机的模板。
class {
file { "/tmp/<file>": ensure => present, content => template('<module>/${hostname}/default.erb', '<module>/common.erb'), audit => content, notify => File["/tmp/<file2>"], } file { "/tmp/<file2>": ensure => present, source => "/tmp/file", audit => content, }
}
当我运行木偶代理时,出现第一个文件语句的内容选项的错误。 我不知道模板函数是否需要直接在模板目录下的模板,或者是否不正确地解释主机名variables。
variables不在单引号内parsing。 当需要插入$variables时使用双引号。
http://docs.puppetlabs.com/guides/language_guide.html#variable-interpolation-with-quotes