Created
January 31, 2014 15:36
-
-
Save xionon/8734350 to your computer and use it in GitHub Desktop.
Big old vagrantfile to spin up multiple nodes
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 : | |
VAGRANTFILE_API_VERSION = "2" | |
NODES = [ | |
['proxy', 1, 10], | |
['app', 1, 20], | |
['db', 1, 30], | |
['cache', 1, 40] | |
] | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
NODES.each do |name, number, ip_start| | |
number.times do |i| | |
n = number == 1 ? name : "#{name}#{number}" | |
config.vm.define n do |conf| | |
conf.vm.box = "CentOS-6.4-x86_64-Minimal" | |
conf.vm.provider "vmware_fusion" do |v| | |
v.gui = false | |
v.vmx['memsize'] = '1024' | |
v.vmx['numvcpus'] = '1' | |
end | |
conf.vm.hostname = "#{n}.conductor.local" | |
conf.vm.network "private_network", ip: ("192.168.33.%d" % [(ip_start + i)]) | |
conf.ssh.forward_agent = true | |
conf.vm.network :forwarded_port, | |
guest: 22, | |
host: (2200 + ip_start + i), | |
id: "ssh", | |
protocol: "ssh", | |
auto_correct: true | |
conf.vm.synced_folder '.', '/data/cached-copy', nfs: File.exist?('.use-nfs') | |
conf.vm.synced_folder '../conductor-themes', '/data/shared/theme_templates', nfs: File.exist?('.use-nfs') | |
conf.omnibus.chef_version = :latest | |
conf.vm.provision :chef_solo do |chef| | |
chef.encrypted_data_bag_secret_key_path = "../conductor-chef/encrypted_data_bag_secret" | |
chef.data_bags_path = "../conductor-chef/data_bags" | |
chef.cookbooks_path = ["../conductor-chef/cookbooks", "../conductor-chef/site-cookbooks"] | |
chef.environments_path = "../conductor-chef/environments" | |
chef.environment = "development" | |
chef.roles_path = "../conductor-chef/roles" | |
chef.add_role("solo") | |
chef.add_role("conductor_#{name}") | |
chef.add_role("vagrant") | |
chef.json = { | |
"deploy" => {"user" => "vagrant"} | |
} | |
end | |
end | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment