-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
138 lines (115 loc) · 4.29 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.ssh.forward_x11 = true
#config.vm.network :private_network, ip: "10.10.10.10"
#config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", owner: "vagrant", group: "vagrant"
#config.vm.synced_folder "../../", "/home/svn-confaudit", id: "svn", owner: "ccn", group: "ccn"
# Change locale
#config.vm.provision :shell, :inline => <<-EOT
# echo 'LC_ALL="es_ES.UTF-8"' > /etc/default/locale
#EOT
bootstrap_args = ''
IMGREPO='http://idefix.dit.upm.es/download/vagrant/'
# Image repository naming schema:
# <dist_name>-<gui>-<vnx>-cloudimg-<arch>-vagrant-disk1-latest.box
# Image repository naming schema examples:
# - trusty-cloudimg-amd64-vagrant-disk1-latest.box
# - xenial-cloudimg-amd64-vagrant-disk1-latest.box
# - xenial-lubuntu-cloudimg-amd64-vagrant-disk1-latest.box
# - xenial-lubuntucore-cloudimg-amd64-vagrant-disk1-latest.box
# - xenial-lubuntu-vnx-cloudimg-amd64-vagrant-disk1-latest.box
# - xenial-vnx-cloudimg-amd64-vagrant-disk1-latest.box -> /var/www/download/vagrant/xenial-vnx-cloudimg-amd64-vagrant-disk1-2016-09-04_23-51.box
# - zesty-lubuntu-vnx-cloudimg-amd64-vagrant-disk1-latest.box -> /var/www/download/vag
case ENV['DIST']
when "trusty", "vivid", "wily", "xenial", "zesty", "artful", "bionic", "focal"
bootstrap_args = bootstrap_args + " -d " + ENV['DIST']
dist = ENV['DIST']
else # default
bootstrap_args = bootstrap_args + " -d trusty"
dist = "trusty"
end
case ENV['GUI']
when "gnome", "lubuntu", "lubuntucore"
bootstrap_args = bootstrap_args + " -g " + ENV['GUI']
url_box_tag = ENV['GUI'] + "-"
url_version_tag = ENV['GUI'] + "-"
else
bootstrap_args = bootstrap_args + " -g no"
url_box_tag = ""
url_version_tag = ""
end
case ENV['VNX']
when "yes"
bootstrap_args = bootstrap_args + " -v yes"
vnx = "vnx-"
else
bootstrap_args = bootstrap_args + " -v no"
vnx = ""
end
case ENV['ARCH']
when "64"
bootstrap_args = bootstrap_args + " -a 64"
config.vm.box = dist + "64-" + url_box_tag + vnx + "updated"
#config.vm.box_url = IMGREPO + dist + "-" + url_version_tag + vnx + "cloudimg-amd64-vagrant-disk1-latest.box"
else
bootstrap_args = bootstrap_args + " -a 32"
config.vm.box = dist + "32-" + url_box_tag + vnx + "updated"
#config.vm.box_url = IMGREPO + dist + "-" + url_version_tag + vnx + "cloudimg-i386-vagrant-disk1-latest.box"
end
config.ssh.forward_x11 = true
config.ssh.insert_key = false
#config.vm.network :private_network, ip: "10.11.11.2", :netmask => "255.255.255.252"
# Change locale
#config.vm.provision :shell, :inline => <<-EOT
# echo 'LC_ALL="es_ES.UTF-8"' > /etc/default/locale
#EOT
if ( ENV['HNAME'] == nil )
# Set default value
bootstrap_args = bootstrap_args + " -n vnx"
else
bootstrap_args = bootstrap_args + " -n #{ENV['HNAME']}"
end
if ( ENV['NEWUSER'] == nil )
# Set default value
bootstrap_args = bootstrap_args + " -u user"
else
bootstrap_args = bootstrap_args + " -u #{ENV['NEWUSER']}"
end
if ( ENV['NEWPASSWD'] == nil )
# Set default value
bootstrap_args = bootstrap_args + " -p xxxx"
else
bootstrap_args = bootstrap_args + " -p #{ENV['NEWPASSWD']}"
end
if ( ENV['VMLANG'] == nil )
# Set default value
bootstrap_args = bootstrap_args + " -l en"
else
bootstrap_args = bootstrap_args + " -l #{ENV['VMLANG']}"
end
if ( ENV['MEM'] == nil )
# Set default value
mem = "2048"
else
mem = "#{ENV['MEM']}"
end
if ( ENV['VCPUS'] == nil )
# Set default value
vcpus = "2"
else
vcpus = "#{ENV['VCPUS']}"
end
config.vm.provision :shell, :path => "bootstrap.sh", :args => bootstrap_args
# To avoid problems with /vagrant mount (sometimes it is not mounted correctly),
# we disable it and create our own mount
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/install"
config.vm.provider :virtualbox do |vb|
vb.gui = true
vb.customize [ "modifyvm", :id, "--memory", mem, "--cpus", vcpus ]
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
vb.customize [ "modifyvm", :id, "--vram", "128"]
#vb.customize [ "modifyvm", :id, "--cableconnected1", "on" ]
end
end