Class: Xanthus::VirtualMachine

Inherits:
Object
  • Object
show all
Defined in:
lib/xanthus/virtual_machine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVirtualMachine

Returns a new instance of VirtualMachine.



12
13
14
15
16
17
18
19
20
21
# File 'lib/xanthus/virtual_machine.rb', line 12

def initialize
  @name = :default
  @box = 'jhcook/fedora27'
  @version = '4.13.12.300'
  @ip = '192.168.33.8'
  @memory = 4096
  @cpus = 2
  @cpu_cap = 70
  @gui = false
end

Instance Attribute Details

#boxObject

Returns the value of attribute box.



4
5
6
# File 'lib/xanthus/virtual_machine.rb', line 4

def box
  @box
end

#cpu_capObject

Returns the value of attribute cpu_cap.



7
8
9
# File 'lib/xanthus/virtual_machine.rb', line 7

def cpu_cap
  @cpu_cap
end

#cpusObject

Returns the value of attribute cpus.



6
7
8
# File 'lib/xanthus/virtual_machine.rb', line 6

def cpus
  @cpus
end

#guiObject

Returns the value of attribute gui.



10
11
12
# File 'lib/xanthus/virtual_machine.rb', line 10

def gui
  @gui
end

#ipObject

Returns the value of attribute ip.



9
10
11
# File 'lib/xanthus/virtual_machine.rb', line 9

def ip
  @ip
end

#memoryObject

Returns the value of attribute memory.



8
9
10
# File 'lib/xanthus/virtual_machine.rb', line 8

def memory
  @memory
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/xanthus/virtual_machine.rb', line 3

def name
  @name
end

#versionObject

Returns the value of attribute version.



5
6
7
# File 'lib/xanthus/virtual_machine.rb', line 5

def version
  @version
end

Instance Method Details

#to_vagrantObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/xanthus/virtual_machine.rb', line 23

def to_vagrant
%Q{
Vagrant.configure(2) do |config|
  config.vm.box = "#{@box}"
  config.vm.box_version = "#{@version}"
  config.vm.network "private_network", ip: "#{@ip}"

  config.vm.provider "virtualbox" do |vb|
   vb.gui = #{@gui}
   vb.memory = #{@memory}
   vb.customize ["modifyvm", :id, "--cpuexecutioncap", "#{@cpu_cap}"]
   vb.cpus = #{@cpus}
   vb.name = "#{@name}"
  end
  config.vm.provision "shell", path: "provision.sh"
end
}
end