-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
70 lines (62 loc) · 2.53 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
# Install required Vagrant plugins
missing_plugins_installed = false
required_plugins = %w(vagrant-cachier vagrant-hostsupdater)
required_plugins.each do |plugin|
if !Vagrant.has_plugin? plugin
system "vagrant plugin install #{plugin}"
missing_plugins_installed = true
end
end
# If any plugins were missing and have been installed, re-run vagrant
if missing_plugins_installed
exec "vagrant #{ARGV.join(" ")}"
end
Vagrant.configure(2) do |config|
config.vm.define :chef_server do |chef_server_config|
chef_server_config.vm.box = "bento/ubuntu-16.04"
chef_server_config.vm.hostname = "chef-server"
chef_server_config.vm.network :private_network, ip: "10.0.15.10"
chef_server_config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provision "shell", inline: "apt-get update && apt-get install -y unzip"
chef_server_config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end
chef_server_config.vm.provision :shell, path: "scripts/bootstrap-chef-server.sh"
end
# Creates the Chef Automate Server
config.vm.define :chef_automate do |chef_automate_config|
chef_automate_config.vm.box = "bento/ubuntu-16.04"
chef_automate_config.vm.hostname = "chef-automate"
chef_automate_config.vm.network :private_network, ip: "10.0.15.13"
chef_automate_config.vm.network "forwarded_port", guest: 80, host: 9000
config.vm.provision "shell", inline: "apt-get update && apt-get install -y unzip"
chef_automate_config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end
chef_automate_config.vm.provision :shell, path: "scripts/bootstrap-chef-automate-server.sh"
end
# Creates the Load Balancer
config.vm.define :lb do |lb_config|
lb_config.vm.box = "bento/centos-7.1"
lb_config.vm.hostname = "lb"
lb_config.vm.network :private_network, ip: "10.0.15.15"
lb_config.vm.network "forwarded_port", guest: 80, host: 8090
lb_config.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
lb_config.vm.provision :shell, path: "scripts/nodes.sh"
end
# Creates the two web servers
(2..3).each do |i|
config.vm.define "web#{i}" do |node|
node.vm.box = "bento/centos-7.2"
node.vm.hostname = "web#{i}"
node.vm.network :private_network, ip: "10.0.15.2#{i}"
node.vm.network "forwarded_port", guest: 80, host: "808#{i}"
node.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
node.vm.provision :shell, path: "scripts/nodes.sh"
end
end
end