Skip to content

Instantly share code, notes, and snippets.

@chadothompson
Created November 6, 2013 17:10
Show Gist options
  • Save chadothompson/7340118 to your computer and use it in GitHub Desktop.
Save chadothompson/7340118 to your computer and use it in GitHub Desktop.
Multi-machine vagrant example
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
$tomcat = <<SCRIPT
echo "172.16.237.150 puppet.itjb.vm puppet" >> /etc/hosts
rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm
puppet agent -t
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.define "puppetmaster" do |puppetmaster|
puppetmaster.vm.box = "precise64"
puppetmaster.vm.hostname = "puppet.itjb.vm"
puppetmaster.vm.network :private_network, ip: "172.16.237.150"
end
config.vm.define "tomcat" do |tomcat|
tomcat.vm.box = "oel6"
tomcat.vm.hostname = "tomcat.itjb.vm"
tomcat.vm.network :private_network, ip: "172.16.237.151"
tomcat.vm.provision :shell, :inline => $tomcat
end
config.vm.define "web" do |web|
web.vm.box = "oel6"
web.vm.hostname = "web.itjb.vm"
web.vm.network :private_network, ip: "172.16.237.161"
web.vm.provision :shell, :inline => $tomcat
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment