Skip to content

Instantly share code, notes, and snippets.

@jjam3774
Created March 20, 2016 21:45
Show Gist options
  • Save jjam3774/73fac152e52e1156f3af to your computer and use it in GitHub Desktop.
Save jjam3774/73fac152e52e1156f3af to your computer and use it in GitHub Desktop.
A Vagrantfile that has 4 servers public network
# -*- 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.
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://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
$updates = <<SCRIPT
apt-get update
apt-get -y install rbenv
SCRIPT
config.vm.provision "shell",
inline: "mkdir -p /opt/scripts; chmod 777 /opt/scripts"
config.vm.provision "shell",
inline: $updates
###############################
# 4 Servers to demonstrate running remote com script
###############################
config.vm.define "server1" do |server1|
server1.vm.hostname = "tango"
server1.vm.network "public_network", ip: "192.168.1.120"
end
config.vm.define "server2" do |server2|
server2.vm.hostname = "charlie"
server2.vm.network "public_network", ip: "192.168.1.130"
end
config.vm.define "server3" do |server3|
server3.vm.hostname = "lima"
server3.vm.network "public_network", ip: "192.168.1.140"
end
config.vm.define "server4" do |server4|
server4.vm.hostname = "master"
server4.vm.network "public_network", ip: "192.168.1.150"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment