使用 Puppet 2.7.11,我需要创建从/usr/local/bin
到的几个符号链接/usr/bin
,并且想要巧妙一点:
class containing_class {
file { [ "/usr/local/bin/job", "/usr/local/bin/jstart",
"/usr/local/bin/jstop", "/usr/local/bin/jsub"]:
ensure => link,
target => regsubst(name, "^/usr/local/bin/", "/usr/bin/")
}
但是,name
会导致链接的目标为name
,$name
并$title
使用containing_class
(!)代替,并且$path
值为$PATH
。
如何在通话中引用单个文件的标题/路径?
答案1
嗯,这可能不是你想要的,但应该可行:
class containing_class {
define bin_link {
file { $title:
ensure => link,
target => regsubst($title, "^/usr/local/bin/", "/usr/bin/"),
}
}
bin_link { [ "/usr/local/bin/job", "/usr/local/bin/jstart",
"/usr/local/bin/jstop", "/usr/local/bin/jsub"]: }
}