Advertisement
Guest User

Untitled

a guest
Dec 20th, 2021
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. Vagrantfile.yaml:
  2. box_image: 'ubuntu-20.04_mini-20211220'
  3. interface: 'eno1'
  4. systems:
  5. smar02: ''
  6.  
  7. ---
  8. Vagrantfile:
  9.  
  10. # -*- mode: ruby -*-
  11. # vi: set ft=ruby :
  12.  
  13. require 'yaml'
  14.  
  15. current_dir = File.dirname(File.expand_path(__FILE__))
  16. myconfigs = YAML.load_file("#{current_dir}/Vagrantfile.yaml")
  17.  
  18. myhostnames = myconfigs['systems']
  19. myinterface = myconfigs['interface']
  20. mybox_image = myconfigs['box_image']
  21.  
  22. Vagrant.configure("2") do |config|
  23. myhostnames.each do |i,x|
  24. config.vm.boot_timeout = 900
  25. config.vm.define vm_name = "#{i}" do |subconfig|
  26. subconfig.vm.box = mybox_image
  27. subconfig.ssh.username = "vmadmin"
  28. subconfig.ssh.password = "vmadmin"
  29. subconfig.vm.hostname = "#{i}"
  30. subconfig.vm.network :public_network, auto_config: false, bridge: myinterface
  31. subconfig.vm.provision "shell", inline: <<-SHELL
  32. /bin/touch /tmp/firstrun
  33. SHELL
  34. subconfig.vm.provider "virtualbox" do |v|
  35. v.name = vm_name
  36. v.customize ["modifyvm", :id, "--paravirtprovider", "kvm"]
  37. v.customize ["modifyvm", :id, "--autostart-enabled", "on"]
  38. v.customize ["modifyvm", :id, "--nictype1", "virtio"]
  39. v.customize ["modifyvm", :id, "--nictype2", "virtio"]
  40. end
  41. end
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement