-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
executable file
·68 lines (52 loc) · 1.76 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# encoding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
# Box / OS
VAGRANT_BOX = 'ubuntu/bionic64'
VM_NAME = 'eduid-dev-vagrant'
settings = YAML.load_file 'vagrant.yml'
eduid_front_path = settings['local_paths']['eduid_front']
eduid_html_path = settings['local_paths']['eduid_html']
vm_cpus = settings['vm']['cpus']
vm_memory = settings['vm']['memory']
vm_disksize = settings['vm']['disksize']
Vagrant.configure(2) do |config|
required_plugins = %w( vagrant-vbguest vagrant-disksize )
_retry = false
required_plugins.each do |plugin|
unless Vagrant.has_plugin? plugin
system "vagrant plugin install #{plugin}"
_retry=true
end
end
if (_retry)
exec "vagrant " + ARGV.join(' ')
end
# Vagrant box from Hashicorp
config.vm.box = VAGRANT_BOX
# Actual machine name
config.vm.hostname = VM_NAME
# Set VM name in Virtualbox
config.vm.provider "virtualbox" do |v|
v.name = VM_NAME
v.cpus = vm_cpus
v.memory = vm_memory
# Change the network adapter type and promiscuous mode
v.customize ['modifyvm', :id, '--nictype1', 'Am79C973']
v.customize ['modifyvm', :id, '--nicpromisc1', 'allow-all']
v.customize ['modifyvm', :id, '--nictype2', 'Am79C973']
v.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
end
# Disk size
config.disksize.size = vm_disksize
# Networking
config.vm.network "private_network", ip: "172.16.10.10"
# Sync folder
config.vm.synced_folder eduid_front_path, '/opt/src/eduid-front/'
config.vm.synced_folder eduid_html_path, '/opt/src/eduid-html/'
config.vm.synced_folder '.', '/opt/eduid-developer/'
#Setup VM
config.vm.provision :shell, path: "vagrant/setup.sh"
config.vm.provision :shell, path: "vagrant/maintenance.sh", run: 'always'
end