Created
November 10, 2013 13:46
-
-
Save krimdomu/7398483 to your computer and use it in GitHub Desktop.
jiffybox
This file contains 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 strict; | |
use warnings; | |
use Rex::Commands::Cloud; | |
use Data::Dumper; | |
user "root"; | |
password "blahblub123%%"; | |
pass_auth; | |
cloud_service "Jiffybox"; | |
cloud_auth "the-access-key"; | |
group jiffybox => get_cloud_instances_as_group(); | |
task "list-plans", sub { | |
print Dumper get_cloud_plans; | |
}; | |
task "list-os", sub { | |
print Dumper get_cloud_operating_systems; | |
}; | |
desc "create a new instance: rex create --name=foo"; | |
task "create", sub { | |
my $param = shift; | |
if(! exists $param->{name}) { | |
die("set name"); | |
} | |
my $vm = cloud_instance create => { | |
image_id => "debian_squeeze_64bit", | |
name => $param->{name}, | |
plan_id => 10, | |
password => "blahblub123%%", | |
}; | |
print Dumper($vm); | |
}; | |
desc "start an instance: rex start --id=id"; | |
task "start", sub { | |
my $param = shift; | |
if(! exists $param->{id}) { | |
die("set id"); | |
} | |
cloud_instance start => $param->{id}; | |
}; | |
task "stop", sub { | |
my $param = shift; | |
if(! exists $param->{id}) { | |
die("set id"); | |
} | |
cloud_instance stop => $param->{id}; | |
}; | |
task "terminate", sub { | |
my $param = shift; | |
if(! exists $param->{id}) { | |
die("set id"); | |
} | |
cloud_instance terminate => $param->{id}; | |
}; | |
task "list", sub { | |
print Dumper cloud_instance_list; | |
}; | |
task "prepare", group => "jiffybox", sub { | |
update_package_db; | |
install "apache2"; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment