定义傀儡的硬链接

有没有一种方法来定义木偶清单内的硬链接?

似乎文件types只能定义符号链接,但我需要它是硬链接,以使我的一些chrooted应用程序工作。 例如,我需要硬链接

/etc/hosts -> $chroot/etc/hosts /etc/resolvf.com -> $chroot/etc/resolv.conf 

等等。

什么可以是最简单的方法来存档呢?

更新:谢谢,我结束了以下定义:

 define hardlinkdir(source=$name, target) { exec { "hardlinkdir-$name": command => "cp -r --link $target $source", path => "/usr/bin:/bin", creates => $source; } } define hardlink(source=$name, target) { exec { "hardlink-$name": command => "ln --force $target $source", path => "/usr/bin:/bin", unless => "test $source -ef $target"; } } 

当然,他们不是完美的,但是他们做这个工作,这是我需要的一切。

感谢您的帮助!

如果找不到其他方法,也可以使用“exec”语句。

 exec { "hardlink1": command => "ln target source", path => "/usr/local/bin:/bin", creates => "yourhardlink" } 

举个例子,用Puppet把相同的文件导出到多个位置也是相当简单的:

  文件{[“/etc/named.conf”,“/var/named/chroot/etc/named.conf”]:
    模式=> 640,
    所有者=> root,
     group =>命名,
    确保=>现在,
     require => [Package ['bind'],Package ['bind-chroot'],],
     source =>“puppet:///modules/named/named.conf”,
   }

为我工作完美这..

 define hardlink($source=$name, $target) { exec { "hardlink-$name": command => "ln -P --force $source $target", path => "/usr/bin:/bin", unless => "test $source -ef $target"; } }