Is there a way to define hardlinks inside puppet manifest?
It seems file type can only define symbolic links, but I need it to be hard links in order to make some of my chrooted applications to work. For example, I need to hardlink
/etc/hosts -> $chroot/etc/hosts
/etc/resolvf.com -> $chroot/etc/resolv.conf
and so on.
What can be the simplest way to archive that?
Update: thanks, I've ended with following defines:
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";
}
}
Sure, they are not perfect, but they does the job and it's everything I need.
Thank you for your help!
You can use also the statement "exec" if you can't find any other way.
works for me perfect this..
It is also fairly trivial to just pipe out the same file to multiple locations with Puppet, as an example: