.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Rex::Box::VBox 3pm" .TH Rex::Box::VBox 3pm "2023-08-09" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Rex::Box::VBox \- Rex/Boxes VirtualBox Module .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a Rex/Boxes module to use VirtualBox VMs. .SH "EXAMPLES" .IX Header "EXAMPLES" To use this module inside your Rexfile you can use the following commands. .PP .Vb 2 \& use Rex::Commands::Box; \& set box => "VBox"; \& \& task "prepare_box", sub { \& box { \& my ($box) = @_; \& \& $box\->name("mybox"); \& $box\->url("http://box.rexify.org/box/ubuntu\-server\-12.10\-amd64.ova"); \& \& $box\->network(1 => { \& type => "nat", \& }); \& \& $box\->network(1 => { \& type => "bridged", \& bridge => "eth0", \& }); \& \& $box\->forward_port(ssh => [2222, 22]); \& \& $box\->share_folder(myhome => "/home/myuser"); \& \& $box\->auth( \& user => "root", \& password => "box", \& ); \& \& $box\->setup("setup_task"); \& }; \& }; .Ve .PP If you want to use a \s-1YAML\s0 file you can use the following template. .PP .Vb 11 \& type: VBox \& vms: \& vmone: \& url: http://box.rexify.org/box/ubuntu\-server\-12.10\-amd64.ova \& forward_port: \& ssh: \& \- 2222 \& \- 22 \& share_folder: \& myhome: /home/myhome \& setup: setup_task .Ve .PP And then you can use it the following way in your Rexfile. .PP .Vb 1 \& use Rex::Commands::Box init_file => "file.yml"; \& \& task "prepare_vms", sub { \& boxes "init"; \& }; .Ve .SH "HEADLESS MODE" .IX Header "HEADLESS MODE" It is also possible to run VirtualBox in headless mode. This only works on Linux and MacOS. If you want to do this you can use the following option at the top of your \fIRexfile\fR. .PP .Vb 1 \& set box_options => { headless => TRUE }; .Ve .SH "METHODS" .IX Header "METHODS" See also the Methods of Rex::Box::Base. This module inherits all methods of it. .ie n .SS "new(name => $vmname)" .el .SS "new(name => \f(CW$vmname\fP)" .IX Subsection "new(name => $vmname)" Constructor if used in \s-1OO\s0 mode. .PP .Vb 1 \& my $box = Rex::Box::VBox\->new(name => "vmname"); .Ve .SS "share_folder(%option)" .IX Subsection "share_folder(%option)" Creates a shared folder inside the \s-1VM\s0 with the content from a folder from the Host machine. This only works with VirtualBox. .PP .Vb 4 \& $box\->share_folder( \& name => "/path/on/host", \& name2 => "/path_2/on/host", \& ); .Ve .SS "info" .IX Subsection "info" Returns a hashRef of vm information. .SS "ip" .IX Subsection "ip" This method return the ip of a vm on which the ssh daemon is listening.