diff options
author | varac <varacanero@zeromail.org> | 2013-06-14 19:47:07 +0200 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2013-06-14 19:47:07 +0200 |
commit | 8a54ee6ff08c7b498e8da8f5e8ca6827c4d0ff58 (patch) | |
tree | 724e8d8fbb9970a5f1f420bd36fbd410a45b6bfc | |
parent | 65dc795b3f2ec99a08b652c2b59555235dbca48b (diff) | |
parent | 1e6fbdf7f1f7e381ef01170eab96727377abe3b6 (diff) |
Merge remote-tracking branch 'leap/parameterized_classes'
Conflicts:
manifests/init.pp
-rw-r--r-- | README | 62 | ||||
-rw-r--r-- | manifests/centos.pp | 2 | ||||
-rw-r--r-- | manifests/debian.pp | 14 | ||||
-rw-r--r-- | manifests/init.pp | 29 | ||||
-rw-r--r-- | manifests/linux.pp | 3 | ||||
-rw-r--r-- | manifests/service.pp | 7 | ||||
-rw-r--r-- | templates/Debian/default | 4 |
7 files changed, 82 insertions, 39 deletions
@@ -0,0 +1,62 @@ +Overview +======== + +This module manages stunnel4. It installs and configures the software, makes +sure it is running, and enables you to create different stunnels. + + +! Upgrade Notice ! +================== + +Previous versions of this module were not using parameterized classes. If you +were using a previous version, you may need to change how you are using the +module to accomodate for that. If you were previously setting some stunnel +variables before including the class, you will now need to pass those variables +to the class as parameters. If you were just simply doing 'include stunnel', +then you will not need to change anything. + +Classes +======= + +stunnel +------- + +This is the main class which brings you stunnel support. You will need to +instantiate it by doing the following: + +class { 'stunnel': } + +Class parameters: + +* ensure_version - If this parameter is passed, you can force a particular + version of stunnel to be installed, if it is available with your packaging + system, for example: + + class { 'stunnel': ensure_version = '3:4.53-1' } + + If you do not pass this parameter, it will default to just be 'present'. + +* startboot (Debian) - This parameter controls if stunnel should be started at + boot or not, if you do not pass this paramter, by default it will be started + +* default_extra (Debian) - This parameter lets you add arbitrary extra text to + the bottom of /etc/default/stunnel4, this can be useful to set ulimit for + example + + +Defines +======= + +stunnel::service +---------------- + +This define lets you setup any number of stunnels, it allows you to pass every +stunnel configuration variable (see manifests/server.pp) which will be used to +create the /etc/stunnel/${name}.conf file, and then notify the stunnel service +so it will restart. + +If you pass $use_nagios to this define, it will create a nagios::service entry +for stunnel_${name} which will watch for the appropriate number processes with +that configuration name + +
\ No newline at end of file diff --git a/manifests/centos.pp b/manifests/centos.pp index 4283cb0..b9a326a 100644 --- a/manifests/centos.pp +++ b/manifests/centos.pp @@ -23,7 +23,7 @@ class stunnel::centos inherits stunnel::linux { file { '/etc/stunnel/stunnel.conf': source => [ "puppet:///modules/site-stunnel/${::fqdn}/stunnel.conf", - "puppet:///modules/site-stunnel/${stunnel_cluster}/stunnel.conf", + "puppet:///modules/site-stunnel/${stunnel::cluster}/stunnel.conf", 'puppet:///modules/site-stunnel/stunnel.conf', "puppet:///modules/stunnel/${::operatingsystem}/stunnel.conf" ], require => Package['stunnel'], diff --git a/manifests/debian.pp b/manifests/debian.pp index a480a2c..eb4d57a 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -9,20 +9,6 @@ class stunnel::debian inherits stunnel::linux { pattern => '/usr/bin/stunnel4', } - # make the /etc/default/stunnel ENABLED configurable with a variable - # and default to on - case $stunnel_startboot { - '': { $stunnel_startboot = '1' } - default: { $stunnel_startboot = '1' } - } - - # make the /etc/default/stunnel extra configurable with a variable - # and default to adding nothing to the default file - case $stunnel_default_extra { - '': { $stunnel_default_extra = '' } - default: { $stunnel_default_extra = '' } - } - file { '/etc/default/stunnel4': content => template('stunnel/Debian/default'), require => Package['stunnel4'], diff --git a/manifests/init.pp b/manifests/init.pp index b398c54..a176bf8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,27 +17,16 @@ # TODO: warn on cert/key issues, fail on false accept? -class stunnel { - - case $stunnel_ensure_version { - '': { $stunnel_ensure_version = 'present' } - default: { $stunnel_ensure_version = 'present' } - } +class stunnel ( + $ensure_version = 'present', + $startboot = '1', + $default_extra = '', + $cluster = '' ) +{ case $::operatingsystem { - debian: { include stunnel::debian } - centos: { include stunnel::centos } - default: { include stunnel::default } - } - - if $use_nagios { - case $nagios_stunnel_procs { - false: { info("We aren't doing nagios checks for stunnel on ${::fqdn}" ) } - default: { - nagios::service { 'stunnel': - check_command => 'nagios-stat-proc!/usr/bin/stunnel4!6!5!proc'; - } - } - } + debian: { class { 'stunnel::debian': } } + centos: { class { 'stunnel::centos': } } + default: { class { 'stunnel::default': } } } } diff --git a/manifests/linux.pp b/manifests/linux.pp index b4b99c6..a4a926e 100644 --- a/manifests/linux.pp +++ b/manifests/linux.pp @@ -1,7 +1,6 @@ class stunnel::linux inherits stunnel::base { - if $stunnel_ensure_version == '' { $stunnel_ensure_version = 'installed' } package { 'stunnel': - ensure => $stunnel_ensure_version + ensure => $stunnel::ensure_version } } diff --git a/manifests/service.pp b/manifests/service.pp index b925d00..fd64f9b 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -51,6 +51,7 @@ define stunnel::service ( $timeoutconnect = false, $timeoutidle = false, $transparent = false, + $use_nagios = false, $verify = false ) { @@ -66,4 +67,10 @@ define stunnel::service ( group => 0, mode => '0600'; } + + if $use_nagios { + nagios::service { "stunnel_${name}": + check_command => "nagios-stat-proc!/usr/bin/stunnel4 /etc/stunnel/${name}.conf!6!5!proc"; + } + } } diff --git a/templates/Debian/default b/templates/Debian/default index 85c4754..9e2f4d3 100644 --- a/templates/Debian/default +++ b/templates/Debian/default @@ -3,11 +3,11 @@ # September 2003 # Change to one to enable stunnel automatic startup -ENABLED=<%= stunnel_startboot %> +ENABLED=<%= scope.lookupvar('stunnel::startboot') %> FILES="/etc/stunnel/*.conf" OPTIONS="" # Change to one to enable ppp restart scripts PPP_RESTART=0 -<%= stunnel_default_extra %> +<%= scope.lookupvar('stunnel::default_extra') %> |