Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

The sysctl cookbook has been deprecated

Author provided reason for deprecation:

The sysctl cookbook has been deprecated and is no longer being maintained by its authors. Use of the sysctl cookbook is no longer recommended.


sysctl (36) Versions 0.5.5

Configures sysctl parameters

cookbook 'sysctl', '= 0.5.5', :supermarket
cookbook 'sysctl', '= 0.5.5'
knife supermarket install sysctl
knife supermarket download sysctl
Quality -%

sysctl Build Status


Set sysctl system control parameters via Chef


  • Debian/Ubuntu
  • RHEL/CentOS
  • Scientific Linux
  • PLD Linux (not tested)


There are two main ways to interact with the cookbook. This is via chef attributes or via the provided LWRP.


  • node['sysctl']['params'] - A namespace for setting sysctl parameters. These will be set during convergence, but will not be automatically persisted into a configuration file. The resource ruby_block[save-sysctl-params] is provided via the default recipe, which you can notify in order to persist these values.
  • node['sysctl']['conf_dir'] - Specifies the sysctl.d directory to be used. Defaults to /etc/sysctl.d on the Debian and RHEL platform families, otherwise nil
  • node['sysctl']['allow_sysctl_conf'] - Defaults to false. Using conf_dir is highly recommended. On some platforms that is not supported. For those platforms, set this to true and the cookbook will rewrite the /etc/sysctl.conf file directly with the params provided. Be sure to save any local edits of /etc/sysctl.conf before enabling this to avoid losing them.




  • apply (default)
  • remove
  • nothing


  • key
  • value

Persistence rules

sysctl values will be persisted to the filesystem (so that they can be
initialized at boot) by this cookbook under the following conditions:

  • You use an LWRP to declare the value, or you declare its value via
    a node attribute (node['sysctl']['params']) and invoke
    ruby_block[save-sysctl-params'] via a notification; and

  • node['sysctl']['conf_dir'] is defined, in which case they are written
    to VALUE/99-chef-attributes.conf; or
    node['sysctl']['allow_sysctl_conf'] is set to true, in which case
    they are written to /etc/sysctl.conf.


# 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

# 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

Ohai Plugin

The cookbook also includes an Ohai 7 plugin that can be installed by adding sysctl::ohai_plugin to your run_list. This will populate node['sys'] with automatic attributes that mirror the layout of /proc/sys.

To see ohai plugin output manually, you can run ohai -d /etc/chef/ohai_plugins sys on the command line.


We have written unit tests using chefspec and integration tests in serverspec 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

Tested with
* Vagrant (version 1.6.1)
* vagrant-omnibus (1.4.1)

Running tests

The following commands will run the tests:

bundle install
bundle exec rubocop
bundle exec foodcritic .
bundle exec rspec
bundle exec kitchen test default-ubuntu-1404
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 14.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.

Dependent cookbooks

ohai >= 0.0.0

Contingent cookbooks

abiquo Applicable Versions
amiga-ppp Applicable Versions
apache_hadoop Applicable Versions
aws-vpc-nat-instance Applicable Versions
bsdznc Applicable Versions
common_linux Applicable Versions
docker Applicable Versions
gateway Applicable Versions
gatling Applicable Versions
hadoop Applicable Versions
hipsnip-mongodb Applicable Versions
iscsi Applicable Versions
kafka-cluster Applicable Versions
kvm Applicable Versions
managed-automate2 Applicable Versions
mapr Applicable Versions
nfs Applicable Versions
openvpn Applicable Versions
os-hardening Applicable Versions
osrm Applicable Versions
paramount Applicable Versions
peopletools Applicable Versions
postgresql91 Applicable Versions
radvd Applicable Versions
redis2 Applicable Versions
resin Applicable Versions
riak Applicable Versions
rubymine Applicable Versions
stig Applicable Versions
swap Applicable Versions
sysctl_d Applicable Versions
zammad Applicable Versions

No quality metric results found