Skip to content

Instantly share code, notes, and snippets.

@wolstena
Created May 9, 2014 21:14
Show Gist options
  • Save wolstena/7718b4784ac0d6993baa to your computer and use it in GitHub Desktop.
Save wolstena/7718b4784ac0d6993baa to your computer and use it in GitHub Desktop.
Vagrant mulit host file
# -*- mode: ruby -*-
# vim: set ft=ruby :
# vim: set smartindent
# vim: set tabstop=2
# vim: set shiftwidth=2
provision = true
project_name = "Varnish"
boxes = [
{ :name => :varnish11, :box => 'lucid64', :ip => '192.168.33.11', :ssh_port => 2201, :http_fwd => 9980, :cpus =>2, :memory => 512 :url => /home/wolstenp/ops/vagrant/boxes//ubuntu-13.04-amd64.box :shares => true },
{ :name => :dmz14, :box => 'openbsd54', :ip => '192.168.33.14', :ssh_port => 2203, :cpus => 1, :memory => 512, :url => /home/wolstenp/ops/vagrant/boxes/openbsd-5.4-amd64.box }
]
boxes.each do |opts|
config.vm.define opts[:name] do |config|
config.vm.box = opts[:box]
config.vm.box_url = opts[:url]
config.vm.customize ["modifyvm", :id, "--memory", opts[:memory]
#todo make this an option
config.vm.forward_port 80, opts[:http_fwd] if opts[:http_fwd]
config.vm.network :hostonly, opts[:ip]
config.vm.host_name = "%s.vagrant" % opts[:name].to_s
config.vm.forward_port 22, opts[:ssh_port], :auto => true
config.vm.customize ["modifyvm", :id, "--cpus", opts[:cpus] ] if opts[:cpus]
# cpus defaults to 1
#config.vm.name = opt[:name]
if provision
config.vm.provision :ansible do |ansible|
ansible.sudo = true
#ansible.sudo_user = 'vagrant'
#ansible.verbose = true
#ansible.ask_sudo_pass = true
ansible.inventory_path = 'provisioning/desktop'
ansible.playbook = 'all.yml'
#ansible.tags = 'ubuntu'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment