我的木偶文件看起来像这样:
# Test finger harry harry.pp exec {'harryd': command => "/usr/bin/finger $title", logoutput => true }
当我运行puppet apply harry.pp我得到这个输出:
notice: /Stage[main]//Exec[harryd]/returns: finger: main: no such user. notice: /Stage[main]//Exec[harryd]/returns: executed successfully notice: Finished catalog run in 0.14 seconds
运行finger harryd得到我预期的输出。 它看起来像傀儡运行finger main ,但我不明白为什么。
$title只是专门设置为定义types范围内的资源的标题,而exec则不是。
所以,如果你有..
define finger { exec { 'finger-$title': command => "/usr/bin/finger $title", logoutput => true } } finger { "harryd": }
..那么这将按预期工作,因为在定义types的范围内, $title被设置为定义types的标题。
你能澄清你想达到什么吗?