Created
April 7, 2014 06:23
-
-
Save initcron/10015582 to your computer and use it in GitHub Desktop.
profider for swap_file, step 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_inline_resources | |
action :create do | |
resource_name = new_resource.file_name.gsub('/', '_') | |
execute "create#{resource_name}" do | |
command "dd if=/dev/zero of=#{new_resource.file_name} bs=1024 count=#{new_resource.blocks}" | |
not_if { ::File.exists?(new_resource.file_name) } | |
notifies :run, "execute[mkswap#{resource_name}]", :immediately | |
end | |
execute "mkswap#{resource_name}" do | |
command "mkswap #{new_resource.file_name}" | |
action :nothing | |
end | |
execute "swapon#{resource_name}" do | |
command "swapon #{new_resource.file_name}" | |
not_if "grep -q #{new_resource.file_name} /proc/swaps" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment