Advertisement
mrbits

Untitled

Mar 22nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.89 KB | None | 0 0
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4. hosts = {
  5.   "client" => "192.168.33.11",
  6.   "server"  => "192.168.33.10",
  7. }
  8.  
  9. Vagrant.configure("2") do |config|
  10.   hosts.each do |name, ip|
  11.     config.vm.define name do |machine|
  12.       machine.vm.box = "bento/ubuntu-14.04"
  13.       machine.vm.hostname = "%s.example.org" % name
  14.       machine.vm.network :private_network, ip: ip
  15.       machine.vm.provider "virtualbox" do |v|
  16.           v.name = name
  17.           v.customize ["modifyvm", :id, "--memory", 200]
  18.       end
  19.       config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
  20.       config.vm.network "forwarded_port", guest: 443, host: 2443, auto_correct: true
  21.       ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
  22.       machine.vm.provision 'shell', inline: "echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys", privileged: false
  23.     end
  24.   end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement