Skip to content

Instantly share code, notes, and snippets.

@fujin
Forked from anonymous/gist:52807
Created January 26, 2009 13:06
Show Gist options
  • Save fujin/52808 to your computer and use it in GitHub Desktop.
Save fujin/52808 to your computer and use it in GitHub Desktop.
node[:xen_vms].each do |name,vm|
execute "create-vm" do
command "xen-create-image --hostname #{name} --ip #{vm[:ip]} --size #{vm[:disk]} --memory #{vm[:memory]}"
creates "/etc/xen/#{name}.cfg"
notifies :run, resources("execute[start-vm")
end
execute "start-vm" do
command => "xm create #{name}.cfg"
unless "xm list | grep #{name}"
action :none
end
link "/etc/xen/#{name}.cfg" do
target_file "/etc/xen/auto/#{name}.cfg"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment