module-tinc/manifests/hostfile.pp

31 lines
741 B
Puppet

# a hostfile for a certain network
# title must be:
# hostname@network
#
define tinc::hostfile(
$source_dir = undef,
$net = undef,
$ensure = present,
) {
# if absent the net should
# clean it up by itself
if $ensure == 'present' {
include tinc
if $tinc::uses_systemd {
$service_name = "tincd@${net}"
} else {
$service_name = 'tinc'
}
if $net and $source_dir {
file{"/etc/tinc/${net}/hosts/${name}":
source => "${source_dir}/${name}",
# to be sure that we manage that net
require => File["/etc/tinc/${net}/hosts"],
notify => Service[$service_name],
owner => root,
group => 0,
mode => '0600';
}
}
}
}