1Rex::Box::Base(3) User Contributed Perl Documentation Rex::Box::Base(3)
2
3
4
6 Rex::Box::Base - Rex/Boxes Base Module
7
9 This is a Rex/Boxes base module.
10
12 These methods are shared across all other Rex::Box modules.
13
14 info
15 Returns a hashRef of vm information.
16
17 name($vmname)
18 Sets the name of the virtual machine.
19
20 setup(@tasks)
21 Sets the tasks that should be executed as soon as the VM is available
22 through SSH.
23
24 storage('path/to/vm/disk')
25 Sets the disk path of the virtual machine. Works only on KVM
26
27 import_vm()
28 This method must be overwritten by the implementing class.
29
30 stop()
31 Stops the VM.
32
33 destroy()
34 Destroy the VM.
35
36 start()
37 Starts the VM.
38
39 ip()
40 Return the ip:port to which rex will connect to.
41
42 status()
43 Returns the status of a VM.
44
45 Valid return values are "running" and "stopped".
46
47 provision_vm([@tasks])
48 Executes the given tasks on the VM.
49
50 cpus($count)
51 Set the amount of CPUs for the VM.
52
53 memory($memory_size)
54 Sets the memory of a VM in megabyte.
55
56 network(%option)
57 Configure the network for a VM.
58
59 Currently it supports 2 modes: nat and bridged. Currently it supports
60 only one network card.
61
62 $box->network(
63 1 => {
64 type => "nat",
65 },
66 }
67
68 $box->network(
69 1 => {
70 type => "bridged",
71 bridge => "eth0",
72 },
73 );
74
75 forward_port(%option)
76 Set ports to be forwarded to the VM. This is not supported by all Box
77 providers.
78
79 $box->forward_port(
80 name => [$from_host_port, $to_vm_port],
81 name2 => [$from_host_port_2, $to_vm_port_2],
82 ...
83 );
84
85 list_boxes
86 List all available boxes.
87
88 url($url)
89 The URL where to download the Base VM Image. You can use self-made
90 images or prebuild images from http://box.rexify.org/.
91
92 auth(%option)
93 Configure the authentication to the VM.
94
95 $box->auth(
96 user => $user,
97 password => $password,
98 private_key => $private_key,
99 public_key => $public_key,
100 );
101
102 options(%option)
103 Addition options for boxes
104
105 $box->options(
106 opt1 => $val1,
107 opt2 => $val2,
108 );
109
110
111
112perl v5.28.0 2017-03-01 Rex::Box::Base(3)