diff modules/firewall/manifests/init.pp @ 39:d6f2a0ee45c0 puppet-3.6

Add "Firewall" module
author IBBoard <dev@ibboard.co.uk>
date Sat, 14 Mar 2015 20:58:03 +0000
parents
children d9352a684e62
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/firewall/manifests/init.pp	Sat Mar 14 20:58:03 2015 +0000
@@ -0,0 +1,40 @@
+# = Class: firewall
+#
+# Manages packages and services required by the firewall type/provider.
+#
+# This class includes the appropriate sub-class for your operating system,
+# where supported.
+#
+# == Parameters:
+#
+# [*ensure*]
+#   Ensure parameter passed onto Service[] resources.
+#   Default: running
+#
+class firewall (
+  $ensure       = running,
+  $service_name = $::firewall::params::service_name,
+  $package_name = $::firewall::params::package_name,
+) inherits ::firewall::params {
+  case $ensure {
+    /^(running|stopped)$/: {
+      # Do nothing.
+    }
+    default: {
+      fail("${title}: Ensure value '${ensure}' is not supported")
+    }
+  }
+
+  case $::kernel {
+    'Linux': {
+      class { "${title}::linux":
+        ensure       => $ensure,
+        service_name => $service_name,
+        package_name => $package_name,
+      }
+    }
+    default: {
+      fail("${title}: Kernel '${::kernel}' is not currently supported")
+    }
+  }
+}