GithubHelp home page GithubHelp logo

isabella232 / sysctl-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zendesk/sysctl

0.0 0.0 0.0 226 KB

sysctl cookbook for chef

Home Page: http://community.opscode.com/cookbooks/sysctl

Ruby 93.56% Shell 6.44%

sysctl-1's Introduction

sysctl Build Status

Description

Set sysctl system control parameters via Opscode Chef

Platforms

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

Usage

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

Attributes

  • 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.

LWRP

sysctl_param

Actions

  • apply (default)
  • remove
  • nothing

Attributes

  • 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']['param']) 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.

Examples

# 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

Development

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)

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-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.

Links

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.

sysctl-1's People

Contributors

svanzoest avatar nukemberg avatar glensc avatar alexfarhadi avatar gregsymons avatar chrisroberts avatar mfischer-zd avatar amitelad7 avatar liku avatar warrenv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.