-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
42 lines (32 loc) · 1.06 KB
/
Vagrantfile
File metadata and controls
42 lines (32 loc) · 1.06 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# require yaml module
require 'yaml'
# read yaml file
settings = YAML.load_file('conf/settings.yml')
Vagrant.configure('2') do |config|
# Define VM base box
config.vm.box = settings['server']['box']
config.vm.hostname = settings['server']['hostname']
# Allocate resources for VM
config.vm.provider 'virtualbox' do |vb|
vb.memory = settings['server']['ram']
vb.cpus = settings['server']['cpus']
end
# Map ports for VM->Host as per the settings.yml
# config.vm.network 'forwarded_port', guest: 80, host: 8080
settings['server']['ports'].each do |ports|
config.vm.network 'forwarded_port',
guest: ports['guest'],
host: ports['host'],
auto_correct: true
end
# Add syncronized folders as per the settings.yml
if settings['synced_folders']
settings['synced_folders'].each do |folders|
config.vm.synced_folder folders['src'], folders['dest'], folders['options']
end
end
# Run the provisioning script.
config.vm.provision "shell", path: "conf/scripts/provision.sh"
end