Last active
September 13, 2019 07:21
-
-
Save wolstena/10931841 to your computer and use it in GitHub Desktop.
Vagrant multi server
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 -*- | |
# vim: set ft=ruby : | |
# vim: set smartindent | |
# vim: set tabstop=2 | |
# vim: set shiftwidth=2 | |
provision = true | |
vagrant_api_version = "2" | |
boxes = [ | |
{ :name => :dmz14, :box => 'openbsd54', :ip => '192.168.33.14', :ip2 => '192.168.33.24', :ssh_port => 2214, :cpus => 1, :memory => 512, :url => "/home/wolstenp/ops/vagrant/boxes/openbsd-5.4-amd64.box", :shares => false }, | |
{ :name => :dmz15, :box => 'openbsd54', :ip => '192.168.33.15', :ip2 => '192.168.33.25', :ssh_port => 2215, :cpus => 1, :memory => 512, :url => "/home/wolstenp/ops/vagrant/boxes/openbsd-5.4-amd64.box", :shares => false } | |
] | |
Vagrant::configure(vagrant_api_version) do |config| | |
boxes.each do |opts| | |
config.vm.define opts[:name] do |config| | |
config.vm.box = opts[:box] | |
config.vm.box_url = opts[:url] | |
config.vm.guest = :openbsd | |
#config.vm.boot_mode = :gui | |
config.vbguest.auto_update = false | |
config.vm.network "forwarded_port", guest: 22, host: opts[:ssh_port], :auto => false | |
config.vm.network "forwarded_port", guest: 80, host: opts[:http_fwd] if opts[:http_fwd] | |
config.vm.network "private_network", ip: opts[:ip] | |
config.vm.network "private_network", ip: opts[:ip2] | |
#config.vm.hostname = "%s.vagrant" % opts[:name].to_s | |
config.vm.synced_folder ".", "/vagrant", disabled: true | |
config.vm.provider :virtualbox do |vb| | |
#vb.customize ["modifyvm", :id, "--memory", opts[:memory], "--cpus", opts[:cpus] ] | |
vb.memory = opts[:memory] | |
vb.cpus = opts[:cpus] | |
end # provider | |
end # define each box | |
end # boxes | |
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 = 'pf' | |
end # provision | |
end # main configuration | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment