Last active
November 13, 2019 07:19
-
-
Save skyrocknroll/310f3af207e3412a6451e861464cdd4d to your computer and use it in GitHub Desktop.
[Vagrant] #vagrant #multimachine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
BOX_IMAGE = "ubuntu/xenial64" | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at | |
# https://docs.vagrantup.com. | |
# Every Vagrant development environment requires a box. You can search for | |
# boxes at https://vagrantcloud.com/search. | |
config.vm.box = "ubuntu/xenial64" | |
config.vm.define "server" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "server" | |
subconfig.vm.network :private_network, ip: "10.7.0.10" | |
subconfig.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "2048"] | |
vb.customize ["modifyvm", :id, "--cpus", "2"] | |
end | |
end | |
config.vm.define "elk" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "elk" | |
subconfig.vm.network :private_network, ip: "10.7.0.11" | |
subconfig.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "4096"] | |
vb.customize ["modifyvm", :id, "--cpus", "2"] | |
end | |
end | |
config.vm.define "agent" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "agent" | |
subconfig.vm.network :private_network, ip: "10.7.0.12" | |
subconfig.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "1024"] | |
vb.customize ["modifyvm", :id, "--cpus", "2"] | |
end | |
end | |
# Create a public network, which generally matched to bridged network. | |
# Bridged networks make the machine appear as another physical device on | |
# your network. | |
# config.vm.network "public_network" | |
# Share an additional folder to the guest VM. The first argument is | |
# the path on the host to the actual folder. The second argument is | |
# the path on the guest to mount the folder. And the optional third | |
# argument is a set of non-required options. | |
# config.vm.synced_folder "../data", "/vagrant_data" | |
# Provider-specific configuration so you can fine-tune various | |
# backing providers for Vagrant. These expose provider-specific options. | |
# Example for VirtualBox: | |
# | |
# config.vm.provider "virtualbox" do |vb| | |
# # Display the VirtualBox GUI when booting the machine | |
# # vb.gui = true | |
# | |
# # Customize the amount of memory on the VM: | |
# vb.memory = "4096" | |
# end | |
# | |
# View the documentation for the provider you are using for more | |
# information on available options. | |
# Enable provisioning with a shell script. Additional provisioners such as | |
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the | |
# documentation for more information about their specific syntax and use. | |
# config.vm.provision "shell", inline: <<-SHELL | |
# apt-get update | |
# apt-get install -y apache2 | |
# SHELL | |
config.vm.provision "shell", inline: <<-SHELL | |
echo "export ip=\"\$(ifconfig | grep -A 1 'enp0s8' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)\"" >> /root/.bashrc | |
echo "export ip=\"\$(ifconfig | grep -A 1 'enp0s8' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)\"" >> /home/ubuntu/.bashrc | |
SHELL | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
BOX_IMAGE = "ubuntu/xenial64" | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at | |
# https://docs.vagrantup.com. | |
# Every Vagrant development environment requires a box. You can search for | |
# boxes at https://vagrantcloud.com/search. | |
config.vm.box = "ubuntu/xenial64" | |
config.vm.define "node1" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "node1" | |
subconfig.vm.network "public_network", bridge: "enp0s31f6" | |
subconfig.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "10500"] | |
vb.customize ["modifyvm", :id, "--cpus", "2"] | |
end | |
end | |
config.vm.define "node2" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "node2" | |
subconfig.vm.network "public_network", bridge: "enp0s31f6" | |
subconfig.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "10500"] | |
vb.customize ["modifyvm", :id, "--cpus", "2"] | |
end | |
end | |
config.vm.define "node3" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "node3" | |
subconfig.vm.network "public_network", bridge: "enp0s31f6" | |
subconfig.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "10500"] | |
vb.customize ["modifyvm", :id, "--cpus", "2"] | |
end | |
end | |
# Create a public network, which generally matched to bridged network. | |
# Bridged networks make the machine appear as another physical device on | |
# your network. | |
# config.vm.network "public_network" | |
# Share an additional folder to the guest VM. The first argument is | |
# the path on the host to the actual folder. The second argument is | |
# the path on the guest to mount the folder. And the optional third | |
# argument is a set of non-required options. | |
# config.vm.synced_folder "../data", "/vagrant_data" | |
# Provider-specific configuration so you can fine-tune various | |
# backing providers for Vagrant. These expose provider-specific options. | |
# Example for VirtualBox: | |
# | |
# config.vm.provider "virtualbox" do |vb| | |
# # Display the VirtualBox GUI when booting the machine | |
# # vb.gui = true | |
# | |
# # Customize the amount of memory on the VM: | |
# vb.memory = "10500" | |
# end | |
# | |
# View the documentation for the provider you are using for more | |
# information on available options. | |
# Enable provisioning with a shell script. Additional provisioners such as | |
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the | |
# documentation for more information about their specific syntax and use. | |
# config.vm.provision "shell", inline: <<-SHELL | |
# apt-get update | |
# apt-get install -y apache2 | |
# SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment