Skip to content

Instantly share code, notes, and snippets.

@apple-corps
Last active August 29, 2015 14:07
Show Gist options
  • Save apple-corps/01f1b082694448fbef7d to your computer and use it in GitHub Desktop.
Save apple-corps/01f1b082694448fbef7d to your computer and use it in GitHub Desktop.
Multi Machine Vagrant
VAGRANTFILE_API_VERSION = "2"
Vagrant::configure(VAGRANTFILE_API_VERSION) do | config |
["nn01","hdp01"].each do | hostname |
config.vm.define hostname do | host |
if hostname.include? "nn" or hostname.include? "esm"
host.vm.box = "CentOS 6.5 x64"
config.vm.box_url = "file://opt/vagrant/vagrant-builder/centos/centos-6-400.box"
else
host.vm.box = "CentOS 6.5 x64"
#config.vm.box_url = "file://opt/vagrant/vagrant-builder/centos/centos-6-800.box"
end
host.vm.hostname = hostname
config.vm.network :public_network, bridge:'em1'
$provision_script= <<SCRIPT
if [[ $(which puppet) != '/usr/bin/puppet' ]]; then
rpm -ivh https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-10.noarch.rpm
yum -q -y install puppet
fi
SCRIPT
config.vm.provision :shell, :inline => $provision_script
config.vm.provision :puppet do |puppet|
#puppet.facter = {
# "fqdn" => hostname
#}
#puppet.options = '--verbose'
#puppet.options = '--parser future'
puppet.module_path = "puppet/modules"
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "site.pp"
end
config.vm.provider :virtualbox do |vb|
vb.gui = false
vb.name = hostname
if vb.name.include? "esm" or vb.name.include? "nn" then
memory="8192"
cpu="40"
else
memory="16384"
cpu="100"
end
vb.customize ["modifyvm", :id, "--cpuexecutioncap", cpu, "--memory", memory, "--cpus", "1"]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment