Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

first commit

  • Loading branch information...
commit 908d5064bb08da3dd642a4d1abdedd4b3a187374 0 parents
authored October 26, 2011
0  README
No changes.
11  manifests/config.pp
... ...
@@ -0,0 +1,11 @@
  1
+# Class: ulimit::config
  2
+#
  3
+#
  4
+class ulimit::config {
  5
+  file {
  6
+    $ulimit::params::ulimit_confdir:
  7
+      ensure  => directory,
  8
+      recurse => true,
  9
+      purge   => true;
  10
+  }
  11
+}
65  manifests/init.pp
... ...
@@ -0,0 +1,65 @@
  1
+# Class: ulimit
  2
+#
  3
+# This class installs ulimit
  4
+#
  5
+# Parameters:
  6
+#
  7
+# Actions:
  8
+#   - Install ulimit
  9
+#
  10
+# Requires:
  11
+#
  12
+# Sample Usage:
  13
+#  node host01 {
  14
+#    class { 'ulimit': }
  15
+#
  16
+#    ulimit::rule {
  17
+#      'foo1':
  18
+#        ensure        => present,
  19
+#        ulimit_domain => 'domain',
  20
+#        ulimit_type   => 'type',
  21
+#        ulimit_item   => 'item',
  22
+#        ulimit_value  => 'value',
  23
+#      'foo2':
  24
+#        ensure        => present,
  25
+#        ulimit_domain => 'domain',
  26
+#        ulimit_type   => 'type',
  27
+#        ulimit_item   => 'item',
  28
+#        ulimit_value  => 'value',
  29
+#    }
  30
+#  }
  31
+#
  32
+class ulimit {
  33
+  class { 'ulimit::params': }
  34
+  class { 'ulimit::config': }
  35
+
  36
+  Class['ulimit::params'] ->
  37
+  Class['ulimit::config']
  38
+
  39
+  # Define: rule
  40
+  # Parameters:
  41
+  #  $ensure, $ulimit_domain, $ulimit_type, $ulimit_item, $ulimit_value
  42
+  #
  43
+  define rule ( $ensure, $ulimit_domain, $ulimit_type, $ulimit_item, $ulimit_value ) {
  44
+    case $ensure {
  45
+      'present': {
  46
+        file {
  47
+          "$ulimit::params::ulimit_confdir/${name}.conf":
  48
+            ensure  => file,
  49
+            content => template ('ulimit/rule.conf.erb');
  50
+        }
  51
+      }
  52
+
  53
+      'absent': {
  54
+        file {
  55
+          "$ulimit::params::ulimit_confdir/${name}":
  56
+            ensure => absent;
  57
+        }
  58
+      }
  59
+
  60
+      default: {
  61
+        fail 'No ensure value found for ulimit rule.'
  62
+      }
  63
+    }
  64
+  }
  65
+}
7  manifests/params.pp
... ...
@@ -0,0 +1,7 @@
  1
+# Class: ulimit::params
  2
+#
  3
+#
  4
+class ulimit::params {
  5
+  $ulimit_name    = 'ulimit'
  6
+  $ulimit_confdir = '/etc/security/limits.d'
  7
+}
7  templates/rule.conf.erb
... ...
@@ -0,0 +1,7 @@
  1
+#
  2
+# File managed by Puppet
  3
+#
  4
+
  5
+# <domain> <type> <item> <value>
  6
+#
  7
+<%= ulimit_domain %>		<%= ulimit_type %>		<%= ulimit_item %>		<%= ulimit_value %>
1  tests/init.pp
... ...
@@ -0,0 +1 @@
  1
+include ulimit

0 notes on commit 908d506

Please sign in to comment.
Something went wrong with that request. Please try again.