this registration is only for non systemd systems

This commit is contained in:
mh 2015-01-03 14:31:29 +01:00
parent 06aa8b9c4e
commit 6aa488e815
2 changed files with 29 additions and 21 deletions

View file

@ -13,6 +13,9 @@ class tinc::centos inherits tinc::base {
ensure => undef,
enable => false,
}
Concat['/etc/tinc/nets.boot']{
ensure => 'absent',
}
} else {
file {
'/etc/sysconfig/tinc' :

View file

@ -16,14 +16,29 @@ define tinc::instance(
$fqdn_tinc = regsubst($::fqdn,'[._-]+','','G')
$tinc_config = "/etc/tinc/${name}/tinc.conf"
# register net for bootup?
$boot_ensure = $ensure ? {
'present' => $connect_on_boot ? {
true => 'present',
default => 'absent'
},
default => 'absent'
}
# which service do we have to manage?
if $tinc::uses_systemd {
$service_name = "tincd@${name}"
service{$service_name: }
if $ensure == 'present' {
Service[$service_name]{
ensure => running,
enable => true,
# if we don't want to start
# on boot, we don't need to
# manage that part of the service
if $boot_ensure == 'present' {
Service[$service_name]{
ensure => running,
enable => true,
}
}
} else {
Service[$service_name]{
@ -34,26 +49,16 @@ define tinc::instance(
}
} else {
$service_name = 'tinc'
# only relevant for non-systemd systems
concat::fragment{"tinc_net_${name}":
ensure => $boot_ensure,
line => "${name}\n",
target => '/etc/tinc/nets.boot',
require => File['/etc/tinc/nets.boot'],
notify => Service[$service_name],
}
}
# register net for bootup
$boot_ensure = $ensure ? {
'present' => $connect_on_boot ? {
true => 'present',
default => 'absent'
},
default => 'absent'
}
concat::fragment{"tinc_net_${name}":
ensure => $boot_ensure,
line => "${name}\n",
target => '/etc/tinc/nets.boot',
require => File['/etc/tinc/nets.boot'],
notify => Service[$service_name],
}
file{"/etc/tinc/${name}":
require => Package['tinc'],
owner => root,