Skip to content

Latest commit

 

History

History

swaps

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

DESCRIPTION:

Configure devices and files for paging and swapping.

REQUIREMENTS:

Linux

ATTRIBUTES:

writeable

* swaps[:total] - total swap size to configure. In MB or % of node.memory.total
* swaps[:filename] - filename for swap file

read-only

* memory[:swaps] - array of hashes from /proc/swaps

USAGE:

Swap size configuration via role:

#roles/swaps-1x.rb
name "swaps-1x"
run_list "swaps::linux"

override_attributes \
:swaps => {
  :total => "100%", #make swap size == total mem size
  :filename => "/tmp/chef-swapfile"
}

Swap configuration attributes:

% knife node show `hostname -f` -a memory.swaps
{
  "memory.swaps": [
    {
      "size": "315384",
      "priority": "-1",
      "used": "0",
      "type": "partition",
      "filename": "/dev/mapper/$hostname-swap_1"
    },
    {
      "size": "983032",
      "priority": "-2",
      "used": "0",
      "type": "file",
      "filename": "/tmp/chef-swapfile"
    }
  ]
}

REFERENCES:

% man swapon

LICENSE & AUTHOR:

Author

Doug MacEachern (<dougm@vmware.com>)

Copyright

2011, VMware, Inc

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

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.