-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
44 lines (33 loc) · 1.15 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Maintained by Billias
# vi: set ft=ruby:
#Prereqs
Vagrant.require_version ">= 1.6.0"
Vagrantfile_Version = "2"
require 'yaml'
# Read YAML file with box details
servers = YAML.load_file('servers.yaml')
#Set variables
suffix = servers["defaults"]["fqdn_suffix"]
# Create boxes
Vagrant.configure(Vagrantfile_Version) do |create|
# Configure servers based on vms hash found in yaml
servers["vms"].each do |servers|
create.vm.define servers["name"] do |srv|
name_of_vm = servers["name"] + "." + suffix
srv.vm.box = servers["box"]
srv.vm.network servers["network"], ip: servers["ip"] if servers["ip"]
srv.vm.host_name = name_of_vm
# Setup Memory and other parameters for your vm (also check `VBoxManage controlvm`)
srv.vm.provider :virtualbox do |vb|
vb.memory = servers["ram"] if servers["ram"]
vb.cpus = servers["cpus"] if servers["cpus"]
if servers["controlvm"] then
servers["controlvm"].each do |dev, devvalue|
controlvmcommand = ['controlvm', :id, dev] + devvalue
vb.customize controlvmcommand
end
end
end
end
end
end