1Rex::Box::KVM(3) User Contributed Perl Documentation Rex::Box::KVM(3)
2
3
4
6 Rex::Box::KVM - Rex/Boxes KVM Module
7
9 This is a Rex/Boxes module to use KVM VMs. You need to have libvirt
10 installed.
11
13 To use this module inside your Rexfile you can use the following
14 commands.
15
16 use Rex::Commands::Box;
17 set box => "KVM";
18
19 task "prepare_box", sub {
20 box {
21 my ($box) = @_;
22
23 $box->name("mybox");
24 $box->url("http://box.rexify.org/box/ubuntu-server-12.10-amd64.kvm.qcow2");
25
26 $box->network(1 => {
27 name => "default",
28 });
29
30 $box->auth(
31 user => "root",
32 password => "box",
33 );
34
35 $box->setup("setup_task");
36 };
37 };
38
39 If you want to use a YAML file you can use the following template.
40
41 type: KVM
42 vms:
43 vmone:
44 url: http://box.rexify.org/box/ubuntu-server-12.10-amd64.kvm.qcow2
45 setup: setup_task
46
47 And then you can use it the following way in your Rexfile.
48
49 use Rex::Commands::Box init_file => "file.yml";
50
51 task "prepare_vms", sub {
52 boxes "init";
53 };
54
56 See also the Methods of Rex::Box::Base. This module inherits all
57 methods of it.
58
59 new(name => $vmname)
60 Constructor if used in OO mode.
61
62 my $box = Rex::Box::KVM->new(name => "vmname");
63
64 memory($memory_size)
65 Sets the memory of a VM in megabyte.
66
67 info
68 Returns a hashRef of vm information.
69
70 ip
71 This method return the ip of a vm on which the ssh daemon is listening.
72
73
74
75perl v5.30.2 2020-04-06 Rex::Box::KVM(3)