]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/sysctl/lib/puppet/type/sysctl.rb
try again, with puppetforge modules, correctly included now
[dsa-puppet.git] / 3rdparty / modules / sysctl / lib / puppet / type / sysctl.rb
diff --git a/3rdparty/modules/sysctl/lib/puppet/type/sysctl.rb b/3rdparty/modules/sysctl/lib/puppet/type/sysctl.rb
new file mode 100644 (file)
index 0000000..722bef7
--- /dev/null
@@ -0,0 +1,41 @@
+Puppet::Type.newtype(:sysctl) do
+
+        @doc = "Manages kernel parameters in /etc/sysctl.conf.  By default this will
+                only edit the configuration file, and not change any of the runtime
+                values.  If you wish changes to be activated right away, you can do
+                so with an exec like so:
+
+                        exec { load-sysctl:
+                            command => \"/sbin/sysctl -p /etc/sysctl.conf\",
+                            refreshonly => true
+                        }
+
+                Set any changes you want to happen right away to notify this command,
+                or you can set it as the default:
+
+                        Sysctl {
+                            notify => Exec[load-sysctl]
+                        }"
+
+        ensurable
+
+        newparam(:name, :namevar => true) do
+            desc "Name of the parameter"
+            isnamevar
+        end
+        
+        newproperty(:val) do
+            desc "Value the parameter should be set to"
+        end
+
+        newproperty(:target) do
+            desc "Name of the file to store parameters in"
+            defaultto { if @resource.class.defaultprovider and
+                           @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
+                            @resource.class.defaultprovider.default_target
+                        else
+                            nil
+                        end
+            }
+        end
+end