File: sysctl.rb

package info (click to toggle)
puppet-module-duritong-sysctl 0.0.11-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: ruby: 161; sh: 10; makefile: 4
file content (41 lines) | stat: -rw-r--r-- 1,481 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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