Rex::Box::KVM(3)
π Rex::Box::KVM β bestie's guide to KVM boxes
okay so quick vibe check: this is the Rex::Box::KVM page from the User Contributed Perl Documentation, section 3 of the manual. yes we're fancy. yeah we're in the man pages. no cap.
β¨ NAME β¨
Rex::Box::KVM β it's the Rex/Boxes KVM Module. that's literally it, that's the name, she's serving exactly what it says on the tin π
π¦ DESCRIPTION π¦
it's a Rex/Boxes module that lets you use KVM VMs π₯
but listen β one (1) non-negotiable: you need to have libvirt installed. that's not a suggestion, that's a whole requirement, bestie. no libvirt, no boxes. π
πΈ EXAMPLES πΈ
using it in your Rexfile
okay so to use this module inside your Rexfile you can use these following commands, and yes you should absolutely copy them:
use Rex::Commands::Box;
set box => "KVM";
task "prepare_box", sub {
box {
my ($box) = @_;
$box->name("mybox");
$box->url("http://box.rexify.org/box/ubuntu-server-12.10-amd64.kvm.qcow2");
$box->network(1 => {
name => "default",
});
$box->auth(
user => "root",
password => "box",
);
$box->setup("setup_task");
};
};
it's giving main character energy honestly π
using a YAML file instead (iykyk)
if YAML is more your vibe, you can use this following template:
type: KVM
vms:
vmone:
url: http://box.rexify.org/box/ubuntu-server-12.10-amd64.kvm.qcow2
setup: setup_task
and then you can use it the following way in your Rexfile:
use Rex::Commands::Box init_file => "file.yml";
task "prepare_vms", sub {
boxes "init";
};
obsessed. genuinely. π«Ά
π METHODS π
also β don't forget to check out the Methods of Rex::Box::Base. this module inherits all methods of it, so anything Base can do, KVM can do too. she ate and left no crumbs. β
π new(name => $vmname)
this one's the constructor, but only if you're using it in OO mode:
my $box = Rex::Box::KVM->new(name => "vmname");
iconic. straightforward. no notes. π
π memory($memory_size)
sets the memory of a VM, measured in megabyte. that's megabytes, plural, don't come for me. π
π§ info
returns a hashRef of vm information. that's it, that's the whole method, and honestly she's thriving. β¨
π ip
this method returns the ip of a vm, specifically the ip on which the ssh daemon is listening. so likeβ¦ the useful one. π
lowkey reminder bestie: libvirt has to be installed for any of this to work. i'm not nagging, i'm just looking out for you. π
and that's the whole page! π this little beauty was served up by perl v5.42.3 on 2023-08-05, and it was literally my pleasure to walk you through it. mwah. π β¨
π¦ where this page comes from
- nixos 26.05: perl5.42.3-Rex 1.14.3
- nixpkgs unstable: perl5.42.3-Rex 1.14.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms