From 6aa488e8155867bb6cda2e1f02963d050911b462 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 3 Jan 2015 14:31:29 +0100 Subject: [PATCH] this registration is only for non systemd systems --- manifests/centos.pp | 3 +++ manifests/instance.pp | 47 ++++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/manifests/centos.pp b/manifests/centos.pp index b9fb602..530f1cd 100644 --- a/manifests/centos.pp +++ b/manifests/centos.pp @@ -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' : diff --git a/manifests/instance.pp b/manifests/instance.pp index 20cd4b5..c264d80 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -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,