define remotefile($owner = root, $group= root, $mode, \
$server = "server.example.com", $cls="base", \
$backup = false, $recurse = false) {
file {
$name:
mode => $mode,
owner => $owner,
group => $group,
backup => $backup,
source => "puppet://$server/$cls/$name"
}
}
puppet already has file defined, we have simply wrapped file in a function that sets some defaults for us.We'll define helpful functions here, since we defined this manifest first in site.pp, we can use any definitions in the subsequent manifests. We'll define a function called remotefile which defines a file to load from the puppet server