From 6cc6a0ae96699367b5f38bcc378670dd69690d91 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 26 Oct 2009 18:57:48 -0400 Subject: initial checkin of augeas-based sysctl puppet module --- README | 20 ++++++++++++++++++++ manifests/init.pp | 24 ++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 README create mode 100644 manifests/init.pp diff --git a/README b/README new file mode 100644 index 0000000..a3980f7 --- /dev/null +++ b/README @@ -0,0 +1,20 @@ +sysctl module +------------- + +This puppet module handles the setting of variables in sysctl.conf, its +a simple module that utilizes the puppet augeas built-in type and the +sysctl binary. You must have the augeas ruby libraries installed to +use this type. + +You can set a value and a comment for that value using this module, +some examples: + +sysctl::config { "vm.mmap_min_addr": + value => 32768, + comment => "Never mmap into the first 32k of memory", +} + +sysctl::config { "fs.file-max": + value => 65536, + comment => "Maximum number of filehandles", +} diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..0bd2e3b --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,24 @@ +class sysctl { + + define config ($value, $comment) { + file { "/etc/sysctl.conf": + mode => 644, + owner => root, + group => root, + ensure => present, + } + + augeas { "sysctl_$name": + context => "/files/etc/sysctl.conf", + changes => [ "set $name $value", "insert #comment before $name", + "set #comment[last()] '$comment'" ], + onlyif => "get $name != $value", + notify => Exec["/sbin/sysctl -p"], + } + + exec { "/sbin/sysctl -p": + subscribe => File["/etc/sysctl.conf"], + refreshonly => true, + } + } +} -- cgit v1.2.3