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


swap_tuning (6) Versions 0.1.3

Creates a swap file of the recommended size considering the system memory.

cookbook 'swap_tuning', '= 0.1.3', :supermarket
cookbook 'swap_tuning', '= 0.1.3'
knife supermarket install swap_tuning
knife supermarket download swap_tuning
Quality 100%


Cookbook Version
Dependency Status
Code Climate
Build Status

Chef cookbook to create a swap file of the recommended size considering the system memory.

This can be considered a general purpose cookbook but certainly not recommended for all cases.

Swap size is chosen based on the following documentation:

RAM Size Recommended Swap
≤ 2 GB 2 × RAM
2 GB - 8 GB = RAM
8 GB - 64 GB ½ × RAM
> 64 GB workload dependent

In case you already have swap in the system, creates another swap file with the difference if necessary.


Supported Platforms

This cookbook has been tested on the following platforms:

  • Amazon
  • Arch Linux
  • CentOS
  • Debian
  • Fedora
  • RedHat
  • Ubuntu

Please, let us know if you use it successfully on any other platform.

Required Cookbooks

Required Applications

  • Ruby 1.9.3 or higher.


Attribute Default Description
node['swap_tuning']['size'] calculated Total swap size in MB.
node['swap_tuning']['minimum_size'] nil Swap minimum size in MB.
node['swap_tuning']['file_prefix'] '/swapfile' Swap file name prefix.
node['swap_tuning']['persist'] true Swap file persist.



Creates the swap file.


Including in a Cookbook Recipe

You can simply include it in a recipe:

# in your recipe
include_recipe 'swap_tuning'

Don't forget to include the swap_tuning cookbook as a dependency in the metadata:

# metadata.rb
depends 'swap_tuning'

Including in the Run List

Another alternative is to include it in your Run List:

  "name": "",
  "run_list": [




Please do not hesitate to open an issue with any questions or problems.




License and Author

Author: Xabier de Zuazo (
Copyright: Copyright (c) 2014, Onddo Labs, SL. (
License: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

swap ~> 0.3

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

CHANGELOG for swap_tuning

This file is used to list changes made in each version of the swap_tuning cookbook.

v0.1.3 (2014-10-20)

  • Support for /[0-9]+KBI/ memory format, fixes some Ubuntu 14.04 installations (fixes issue #1, thanks @amirarabi for the help).
  • updated.
  • README: include_recipe example without recipe name.

v0.1.2 (2014-10-17)

  • Chef::SwapTuning: add a missing space.
  • metadata: depends swap with pessimistic operator.
  • ChefSpec: use SoloRunner instead of Runner.
  • Fix RuboCop offense.
  • Add Serverspec tests.
    • Add Gemfile to Serverspec tests.
  • Use swap cookbook 0.3.8 ChefSpec matchers.
  • kitchen.yml: include more platform versions.
  • travis.yml: exclude some groups from bundle.
  • Add rubocop.yml with AllCops:Include.
  • Berkfile: use a generic Berksfile template.
  • Gemfile:
    • Update versions.
    • Berkshelf update to 3.1.
    • Refactor to use style, unit and integration groups.
    • Replace vagrant gem by vagrant-wrapper.
  • Rakefile: Add docu link and include kitchen only when needed.
  • Add Guardfile.
  • Add license header file to all ruby files.
    • Use markdown tables.
    • Use single quotes in examples.
  • TODO: use checkboxes.
  • Some small documentation improvements.

v0.1.1 (2014-07-26)

    • added an empty line above a table tag.
    • created CONTRIBUTING, TESTING and TODO files.
    • error fix: #<Encoding::InvalidByteSequenceError: "\xE2" on US-ASCII.
  • TODO: added some tasks.
  • Remove old comment from spec/spec_helper.rb.
  • Added RedHat as supported.

v0.1.0 (2014-07-14)

  • Initial release of swap_tuning.

Foodcritic Metric

0.1.3 passed this metric