----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 512
v.cpus = 2
end
#Enter the web tier cluster size here for better scalability:
#NOTE: if you choose to scale up while the environment is up and runnig -
#make sure to re-provision the haproxy server for the new configuration to apply. (vagrant provision <apacheservername>)
WebFarm = 3
config.vm.define :haproxy do |haproxyserver|
haproxyserver.vm.box = "ubuntu/precise64"
haproxyserver.vm.network :private_network, ip: "192.168.50.2"
haproxyserver.vm.provision "shell", path: "haproxy.sh", env: {"WEB_CLUSTER_SIZE" => WebFarm}, run: "always"
haproxyserver.vm.hostname = "HAproxyServer"
end
(1..WebFarm).each do |i|
config.vm.define "apacheserver0#{i}" do |node|
node.vm.box = "ubuntu/precise64"
node.vm.hostname = "apacheserver0#{i}"
node.vm.network "private_network", ip: "192.168.50.10#{i}"
node.vm.provision "shell", path: "apache.sh", run: "always", args: "apacheserver0#{i} 192.168.50.10#{i}"
end
end
config.vm.define :logstash do |logstashserver|
logstashserver.vm.box = "centos/7"
logstashserver.vm.box_version = "1803.01"
logstashserver.vm.network :private_network, ip: "192.168.50.3"
logstashserver.vm.provision "shell", path: "logstash.sh", run: "always"
logstashserver.vm.hostname = "logstashserver"
end
config.vm.define :elasticsearch do |elasticsearchserver|
elasticsearchserver.vm.box = "centos/7"
elasticsearchserver.vm.box_version = "1803.01"
elasticsearchserver.vm.network :private_network, ip: "192.168.50.4"
elasticsearchserver.vm.provision "shell", path: "elastic.sh", run: "always"
elasticsearchserver.vm.hostname = "elasticsearchserver"
end
end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'm using the instructions from formal sites, thus - I created this provision shell script:
#!/bin/bash
# Install Java "1.8.0_161"
sudo yum install -y java
# Install logstash
sudo cp -f /vagrant/logstash.repo /etc/yum.repos.d
sudo yum update
sudo yum --enablerepo=logstash-6.x clean metadata
sudo yum install -y logstash
sudo cp -f /vagrant/logstashbeats-input.conf /etc/logstash/conf.d
sudo mkdir /etc/logstash/patterns
sudo cp -f /vagrant/iptables.patterns /etc/logstash/patterns
sudo /usr/share/logstash/bin/system-install
sudo systemctl start logstash.service
Every time I run 'vagrant up' command the installation hangs on the logstash yum install command.
When I exit the installation and run it from the host (e.g.vagrant ssh) it works just fine.