Advertisement
Guest User

vagrantp

a guest
Apr 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. nodes = [
  2. { :hostname => '0001web1', :ip => '192.168.33.10', :box => 'ubuntu/xenial64' },
  3. { :hostname => '0001web2', :ip => '192.168.33.11', :box => 'ubuntu/xenial64' },
  4. { :hostname => '0001lb1', :ip => '192.168.33.12', :box => 'ubuntu/xenial64' },
  5. { :hostname => '0001db1', :ip => '192.168.33.13', :box => 'ubuntu/xenial64' }
  6. ]
  7.  
  8. Vagrant.configure("2") do |config|
  9. nodes.each do |node|
  10. config.vm.define node[:hostname] do |nodeconfig|
  11. nodeconfig.vm.box = "ubuntu/xenial64"
  12.  
  13. nodeconfig.vm.hostname = node[:hostname] + ".box"
  14. nodeconfig.vm.network :private_network, ip: node[:ip]
  15. nodeconfig.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/me.pub"
  16. nodeconfig.vm.provision "shell", inline: "cat ~vagrant/.ssh/me.pub >> ~vagrant/.ssh/authorized_keys"
  17. end
  18. end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement