Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vagrantfile.yaml:
- box_image: 'ubuntu-20.04_mini-20211220'
- interface: 'eno1'
- systems:
- smar02: ''
- ---
- Vagrantfile:
- # -*- mode: ruby -*-
- # vi: set ft=ruby :
- require 'yaml'
- current_dir = File.dirname(File.expand_path(__FILE__))
- myconfigs = YAML.load_file("#{current_dir}/Vagrantfile.yaml")
- myhostnames = myconfigs['systems']
- myinterface = myconfigs['interface']
- mybox_image = myconfigs['box_image']
- Vagrant.configure("2") do |config|
- myhostnames.each do |i,x|
- config.vm.boot_timeout = 900
- config.vm.define vm_name = "#{i}" do |subconfig|
- subconfig.vm.box = mybox_image
- subconfig.ssh.username = "vmadmin"
- subconfig.ssh.password = "vmadmin"
- subconfig.vm.hostname = "#{i}"
- subconfig.vm.network :public_network, auto_config: false, bridge: myinterface
- subconfig.vm.provision "shell", inline: <<-SHELL
- /bin/touch /tmp/firstrun
- SHELL
- subconfig.vm.provider "virtualbox" do |v|
- v.name = vm_name
- v.customize ["modifyvm", :id, "--paravirtprovider", "kvm"]
- v.customize ["modifyvm", :id, "--autostart-enabled", "on"]
- v.customize ["modifyvm", :id, "--nictype1", "virtio"]
- v.customize ["modifyvm", :id, "--nictype2", "virtio"]
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement