-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVagrantfile
150 lines (139 loc) · 5.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
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
139
140
141
142
143
144
145
146
147
148
149
150
# -*- mode: ruby -*-
# vi: set ft=ruby :
nodes = { 'draco' => {
:box => 'centos/7',
:mac => '020027000099',
:net => 'icinga-book.local',
},
'aquarius' => {
:box => 'centos/7',
:mac => '020027000016',
:memory => '512',
:net => 'icinga-book.local',
},
'carina' => {
:box => 'centos/7',
:mac => '020027000012',
:memory => '512',
:net => 'icinga-book.local',
},
'antlia' => {
:box => 'centos/7',
:mac => '020027000212',
:net => 'icinga-book.net',
:forwarded => {
'443' => '8443',
'80' => '8080',
},
},
'gmw' => {
:box => 'centos/7',
:mac => '020027000013',
:net => 'icinga-book.local',
},
'kmw' => {
:box => 'centos/7',
:mac => '020027000213',
:net => 'icinga-book.net',
},
'sextans' => {
:box => 'centos/7',
:mac => '020027000014',
:net => 'icinga-book.local',
},
'sagittarius' => {
:box => 'centos/7',
:mac => '020027000214',
:net => 'icinga-book.net',
},
# 'andromeda' => {
# :box => 'w2k12r2-x64-virtualbox',
# :url => 'http://boxes.icinga.org/vagrant/private/w2k12r2.box',
# :mac => '020027000022',
# :memory => '1024',
# :net => 'icinga-book.local',
# :gui => true,
# },
# 'phoenix' => {
# :box => 'dploeger/oracle-XE-11.2-x86_64',
# :mac => '020027000015',
# :memory => '1024',
# :net => 'icinga-book.local',
# },
'sculptor' => {
:box => 'centos/7',
:mac => '020027000211',
:net => 'icinga-book.net',
},
'fornax' => {
:box => 'centos/7',
:mac => '020027000011',
:memory => '512',
:net => 'icinga-book.local',
},
}
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.0"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box]
node_config.vm.hostname = name
node_config.vm.host_name = name + "." + options[:net] if options[:box] != "w2k12r2-x64-virtualbox"
node_config.vm.box_url = options[:url] if options[:url]
node_config.vm.network :private_network, :adapter => 2, type: "dhcp", virtualbox__intnet: options[:net]
node_config.vm.provider :virtualbox do |vb|
vb.linked_clone = true if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new(VAGRANT_REQUIRED_LINKED_CLONE_VERSION)
vb.name = name
vb.gui = options[:gui]
vb.customize ["modifyvm", :id,
"--groups", "/Icinga Book/" + options[:net],
"--memory", "384",
"--audio", "none",
"--usb", "on",
"--usbehci", "off",
"--nic2", "intnet",
"--intnet2", options[:net],
"--macaddress2", options[:mac],
]
vb.memory = options[:memory] if options[:memory]
end
node_config.ssh.forward_agent = true
if options[:box] != "w2k12r2-x64-virtualbox"
node_config.vm.provision :shell, :path => 'scripts/pre-install.sh'
else
node_config.vm.provision :shell, :path => 'scripts/pre-install.bat'
end
if options[:forwarded]
options[:forwarded].each_pair do |guest, local|
node_config.vm.network "forwarded_port", guest: guest, host: local
end
end
node_config.vm.provision :puppet do |puppet|
if options[:box] != "w2k12r2-x64-virtualbox"
puppet.environment_path = "puppet/environments"
else
puppet.environment_path = "puppet/environments.windows"
end
puppet.environment = ENV['VAGRANT_PUPPET_ENV'] if ENV['VAGRANT_PUPPET_ENV']
puppet.hiera_config_path = "puppet/hiera.yaml"
puppet.facter = {
"domain" => options[:net],
"fqdn" => name + "." + options[:net],
}
end
end
end
config.vm.define "draco" do |draco|
draco.vm.network :private_network, :adapter => 2, ip: "172.16.1.254", virtualbox__intnet: "icinga-book.local"
draco.vm.network :private_network, :adapter => 3, ip: "172.16.2.254", virtualbox__intnet: "icinga-book.net"
draco.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--nic3", "intnet"]
vb.customize ["modifyvm", :id, "--intnet3", "icinga-book.net" ]
end
end
config.vm.define "fornax" do |fornax|
fornax.vm.network :private_network, :adapter => 3, ip: "192.168.56.10"
end
end