forked from Normation/rudder-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
133 lines (111 loc) · 4.48 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
#####################################################################################
# Copyright 2012 Normation SAS
#####################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#####################################################################################
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
# VM declaration
# name : VM os name in vagrant
# box : Box name
# url : URL where to fetch the box
# server : File to use as server provisionning script (they are in provision folder)
# node : File to use as node provisionning script (they are in provision folder)
#################### SERVER BOXES ###########################
debian6 = {
:name => "debian6",
:box => "debian-squeeze-64",
:url => "http://dl.dropbox.com/u/937870/VMs/squeeze64.box",
:server => "server.sh",
:node => "node.sh"
}
debian7 = {
:name => "debian",
:box => "debian-7.0-amd64-minimal",
:url => "https://www.dropbox.com/s/gxouugzbnjlny1k/debian-7.0-amd64-minimal.box",
:server => "server.sh",
:node => "node.sh"
}
sles11 = {
:name => "sles",
:box => "sles-11-64",
:url => "http://puppetlabs.s3.amazonaws.com/pub/sles11sp1_64.box",
:server => "server_sles11.sh",
:node => "node_sles11.sh"
}
ubuntu12_10 = {
:name => "ubuntu",
:box => "ubuntu12.10",
:url => "http://static.aldoborrero.com/vagrant/quantal64.box",
:server => "server_ubuntu.sh",
:node => "node_ubuntu.sh"
}
centos6 = {
:name => "centos",
:box => "centos6",
:url => "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.3-x86_64-v20130101.box",
:server => "server_centos6.sh",
:node => "node_centos6.sh"
}
#################### NODE BOXES ###########################
centos5 = {
:name => "centos5",
:box => "centos5",
:url => "http://www.lyricalsoftware.com/downloads/centos-5.7-x86_64.box",
:node => "node_centos5.sh"
}
os = [ debian6, debian7, sles11, ubuntu12_10, centos6, centos5]
server = { :ip => "192.168.42.10",
:hostname => "server"
}
os.each { |os|
# Declare server boxes if server provisionning script is declared
if os[:server]
config.vm.define ("server_"+os[:name]).to_sym do |server_config|
server_config.vm.box = os[:box]
server_config.vm.box_url = os[:url]
server_config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1536"]
end
server_config.vm.network :forwarded_port, guest: 80, host: 8080
server_config.vm.network :forwarded_port, guest: 443, host: 8081
server_config.vm.network :private_network, ip: server[:ip]
server_config.vm.hostname = server[:hostname]
server_config.vm.provision :shell, :path => "provision/"+os[:server]
end
end
(1..10).each { |i|
n = i.to_s()
config.vm.define ("node"+n+"_"+os[:name]).to_sym do |node_config|
node_config.vm.provision :shell, :path => "provision/"+os[:node]
node_config.vm.network :private_network, ip: "192.168.42.1"+n
node_config.vm.box = os[:box]
node_config.vm.box_url = os[:url]
node_config.vm.provider :virtualbox
node_config.vm.hostname = "node"+n
end
}
}
end