Sha256: 4bf9bd46e0c4f82b4791cb6349f7629f2a7146dc23d5819598db84a43eb62e76

Contents?: true

Size: 454 Bytes

Versions: 6

Compression:

Stored size: 454 Bytes

Contents

swapfile_location = "/swapfile"
swap_in_megabytes = 512

execute "create swapfile" do
  command "dd if=/dev/zero of=#{swapfile_location} bs=1024 count=#{swap_in_megabytes*1024}"
  not_if { File.exists?(swapfile_location) }
end

execute "mkswap" do
  command "mkswap /swapfile"
  not_if "file #{swapfile_location} | grep -q 'swap file'"
end

execute "swapon" do
  command "swapon #{swapfile_location}"
  not_if "cat /proc/swaps  | grep -q '/swapfile'"
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lobot-0.9.7 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.9.6 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.9.5 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.9.4 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.9.2 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb
lobot-0.9.0 lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/swap.rb