Skip to content

Commit

Permalink
This commit adds a 'system_sysctl' parameter to Redis class.
Browse files Browse the repository at this point in the history
This parameter is disabled (false) by default, but when enabled
sets the vm.overcommit_memory=1 sysctl setting on the Linux server.
In order to set this sysctl setting the sysctl module must be available.
The sysctl module required dependency was added to the Modulefile file.

The README.md file was updated to state how to use the 'system_sysctl'
parameter.

Some grammar changes.
  • Loading branch information
Tehmasp Chaudhri committed Feb 19, 2014
1 parent e4c8cb7 commit 6310d8d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ description 'Module to install and configure a Redis server'
project_page 'https://github.com/fsalum/puppet-redis'

## Add dependencies, if any:

# https://forge.puppetlabs.com/thias/sysctl
dependency 'thias/sysctl', '0.3.0'
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Redis Module for Puppet
=======================
[![Build Status](https://secure.travis-ci.org/fsalum/puppet-redis.png)](http://travis-ci.org/fsalum/puppet-redis)

This module install and manages the Redis server. All redis.conf options are
This module installs and manages a Redis server. All redis.conf options are
accepted in the parameterized class.

Operating System
Expand All @@ -27,7 +27,15 @@ To change the port and listening network interface:
Parameters
----------

Check the [init.pp](https://github.com/fsalum/puppet-redis/blob/master/manifests/init.pp) file for a list of parameters accepted.
Check the [init.pp](https://github.com/fsalum/puppet-redis/blob/master/manifests/init.pp) file for a complete list of parameters accepted.

To enable and set important Linux kernel sysctl parameters as described in the [Redis Admin Guide](http://redis.io/topics/admin) - use the following configuration option:

class { 'redis':
system_sysctl => true
}

By default, this sysctl parameter will not be enabled. Furthermore, you will need the sysctl module defined in the [Modulefile](https://github.com/fsalum/puppet-redis/blob/master/Modulefile) file.

Copyright and License
---------------------
Expand Down
13 changes: 9 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
# === Parameters
#
# All the redis.conf parameters can be passed to the class.
# Check the README.md file
# See below for a complete list of parameters accepted.
#
# === Variables
#
# Here you should define a list of variables that this module would require.
# Check the README.md file for any further information about parameters for this class.
#
# === Examples
#
Expand All @@ -30,6 +28,7 @@
$package_ensure = 'present',
$service_ensure = 'running',
$service_enable = true,
$system_sysctl = false,
$conf_daemonize = 'yes',
$conf_pidfile = 'UNSET',
$conf_port = '6379',
Expand Down Expand Up @@ -152,4 +151,10 @@
require => Exec[$conf_dir],
}

if ( $system_sysctl == true ) {
# add necessary kernel parameters
# see the redis admin guide here: http://redis.io/topics/admin
sysctl { 'vm.overcommit_memory': value => '1' }
}

}

0 comments on commit 6310d8d

Please sign in to comment.