-
Notifications
You must be signed in to change notification settings - Fork 12
/
Vagrantfile.example
107 lines (88 loc) · 4.39 KB
/
Vagrantfile.example
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
$default_system_name = "OpenRecords_" + Time.now.strftime("%m-%d-%Y_%H-%M")
$redhat_username = ENV['RH_USER'] || "<INSERT_USERNAME_HERE>"
$redhat_password = ENV['RH_PASSWORD'].to_s.empty? ? "<INSERT_PASSWORD_HERE>" : ENV['RH_PASSWORD']
$rhsn_system_name = ENV['RHSN_SYSTEM_NAME'].to_s.empty? ? $default_system_name : ENV['RHSN_SYSTEM_NAME']
Vagrant.configure("2") do |config|
config.vm.box = "generic/rhel7"
config.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "4096"
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
if ENV['http_proxy']
# Proxy Configuration
config.vm.provision "shell" do |s|
s.inline = 'sudo cp /vagrant/build_scripts/proxy.sh /etc/profile.d/'
end
config.vm.provision :reload
end
# RedHat Subscription Management
config.vm.provision "shell" do |s|
s.path = "build_scripts/subscription_manager.sh"
s.args = [$redhat_username, $redhat_password, $rhsn_system_name]
end
config.vm.provision :reload
config.vm.provision "shell" do |s|
s.inline = 'sudo yum -y groupinstall "Development Tools" && sudo /etc/init.d/vboxadd setup && echo "cd /vagrant" >> /home/vagrant/.bash_profile'
end
# Single server VM
config.vm.define "default", primary: true do |default|
default.vm.network "forwarded_port", guest: 80, host: 8080
default.vm.network "forwarded_port", guest: 443, host: 8443
default.vm.network "forwarded_port", guest: 5000, host: 8000
default.vm.network "forwarded_port", guest: 5432, host: 8432
default.vm.network "forwarded_port", guest: 8200, host: 8200
default.vm.network "private_network", ip: "10.0.0.2"
default.vm.provision "shell", path: "build_scripts/web_setup/web_setup.sh", args: 'single_server'
# default.vm.provision "shell", path: "build_scripts/filebeat_setup/app_nginx/install.sh"
default.vm.provision "shell", path: "build_scripts/es_setup/es_setup.sh", args: 'single_server'
default.vm.provision "shell", path: "build_scripts/db_setup/db_setup.sh", args: 'single_server'
default.vm.provision "shell", path: "build_scripts/app_setup/app_setup.sh"
default.vm.provision "shell", path: "build_scripts/app_setup/setup_virtualenv.sh", privileged: false
end
# VM for Sentry
config.vm.define "sentry" do |sentry|
sentry.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
sentry.vm.network "forwarded_port", guest: 9000, host: 9090
sentry.vm.network "private_network", ip: "10.0.0.3"
sentry.vm.provision "shell", path: "build_scripts/sentry_setup/nginx_setup.sh"
sentry.vm.provision "shell", path: "build_scripts/sentry_setup/db_setup_install.sh"
sentry.vm.provision "shell", path: "build_scripts/sentry_setup/db_setup_config.sh"
sentry.vm.provision "shell", path: "build_scripts/sentry_setup/setup.sh"
end
# VM for ELK
config.vm.define "elk" do |elk|
elk.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end
elk.vm.network "forwarded_port", guest: 9200, host: 9201
elk.vm.network "forwarded_port", guest: 5601, host: 5602
elk.vm.network "forwarded_port", guest: 5044, host: 5044
elk.vm.network "private_network", ip: "10.0.0.4"
elk.vm.provision "shell", path: "build_scripts/elk_setup/elasticsearch/setup.sh"
elk.vm.provision "shell", path: "build_scripts/elk_setup/kibana/setup.sh"
elk.vm.provision "shell", path: "build_scripts/elk_setup/logstash/setup.sh"
elk.vm.provision "shell", path: "build_scripts/elk_setup/nginx/setup.sh"
end
config.trigger.before :destroy, :force => true, :vm => ["default"] do # add more VMs if necessary
run_remote "subscription-manager unsubscribe --all"
run_remote "subscription-manager unregister"
end
# VM for Consul/Vault
config.vm.define "consul" do |consul|
consul.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
consul.vm.network "forwarded_port", guest: 443, host: 8443
consul.vm.network "forwarded_port", guest: 8500, host: 8501
consul.vm.network "forwarded_port", guest: 8200, host: 8201
consul.vm.network "private_network", ip: "10.0.0.5"
consul.vm.provision "shell", path: "build_scripts/consul-vault_setup/consul_setup.sh"
consul.vm.provision "shell", path: "build_scripts/consul-vault_setup/vault_setup.sh"
consul.vm.provision "shell", path: "build_scripts/consul-vault_setup/nginx/nginx_setup.sh"
end
end