You want to create a symlink using puppet.
class symlinker {
# preferred symlink syntax
file { '/tmp/link-to-motd':
ensure => 'link',
target => '/etc/motd',
}
# older, less clear syntax
file { '/tmp/link-to-motd':
ensure => '/etc/motd',
}
}
Although it may seem slightly counter intuitive at first you create and
manage symlinks through the file
type. It's worth noting that the
title (in this example /tmp/link-to-motd
) is the name of the link to
create and the file name given in ensure
is the file to link to. If you
get these two options the wrong way around then you'll probably need to
start reading the filebucket
section.
The second example, with the target defined in the ensure
, is
essentially deprecated and should not be used. This will be detected by
puppet-lint
and appear as [ensure_not_symlink_target] symlink target
specified in ensure attr
.