cookbook 'sysctl', '= 0.4.0', :supermarket
Configures sysctl parameters
cookbook 'sysctl', '= 0.4.0'
knife cookbook site install sysctl
knife cookbook site download sysctl
Set sysctl system control parameters via Opscode Chef
- Scientific Linux
- PLD Linux (not tested)
node['sysctl']['params']- A namespace for setting sysctl parameters
node['sysctl']['conf_dir']- Specifies the sysctl.d directory to be used. Defaults to
/etc/sysctl.don the Debian and RHEL platform families, otherwise
node['sysctl']['allow_sysctl_conf']- Defaults to false. Using
conf_diris highly recommended. On some platforms that is not supported. For those platforms, set this to
trueand the cookbook will rewrite the
/etc/sysctl.conffile directly with the params provided. Be sure to save any local edits of
/etc/sysctl.confbefore enabling this to avoid losing them.
- apply (default)
# set vm.swapiness to 20 via attributes node.default['sysctl']['params']['vm']['swappiness'] = 20 # set vm.swapiness to 20 via sysctl_param LWRP sysctl_param 'vm.swappiness' do value 20 end # remove sysctl parameter and set net.ipv4.tcp_fin_timeout back to default sysctl_param 'net.ipv4.tcp_fin_timeout' do value 30 action :remove end
We have written unit tests using chefspec and integration tests in bats executed via test-kitchen. Much of the tooling around this cookbook is exposed via guard and test kitchen, so it is highly recommended to learn more about those tools.
Vagrant Plugin Dependencies
The integration tests can be run via test-kitchen using vagrant, but it depends on the following vagrant plugins:
vagrant plugin install vagrant-omnibus vagrant plugin install vagrant-berkshelf
Tested with * Vagrant (version 1.4.3) * vagrant-berkshelf (1.3.5) * vagrant-omnibus (1.1.2)
The following commands will run the tests:
bundle install bundle exec rubocop bundle exec foodcritic . bundle exec rspec bundle exec kitchen test default-ubuntu-1204 bundle exec kitchen test default-centos-65
The above will do ruby style (rubocop) and cookbook style (foodcritic) checks followed rspec unit tests ensuring proper cookbook operation.Integration tests will be run next on two separate linux platforms (Ubuntu 12.04 LTS Precise 64-bit and CentOS 6.5). Please run the tests on any pull requests that you are about to submit and write tests for defects or new features to ensure backwards compatibility and a stable cookbook that we can all rely upon.
Running tests continuously with guard
This cookbook is also setup to run the checks while you work via the guard gem.
bundle install bundle exec guard start
ChefSpec LWRP Matchers
The cookbook exposes a chefspec matcher to be used by wrapper cookbooks to test the cookbooks LWRP. See
library/matchers.rb for basic usage.
There are a lot of different documents that talk about system control parameters, the hope here is to point to some of the most useful ones to provide more guidance as to what the possible kernel parameters are and what they mean.
- Linux Kernel Sysctl
- Linux Kernel IP Sysctl
- THE /proc FILESYSTEM (Jun 2009)
- RHEL 5 VM/Page Cache Tuning Presentation (2009) pdf
- Arch Linux SysCtl Tutorial (Feb 2013)
- Old RedHat System Tuning Overview (2001!)
- Tuning TCP For The Web at Velocity 2013 (video), slides
- Adventures in Linux TCP Tuning (Nov 2013)
- Part 1: Lessons learned tuning TCP and Nginx in EC2 (Jan 2014)
This cookbook has no specified dependencies.