Vagrantfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Vagrant.require_version ">= 2.2.6"
  2. nodes = [
  3. { :hostname => 'generic1.vagrant', :ip => '172.11.91.210', :box => 'bento/ubuntu-18.04', :ram => '512', :cpus => 1},
  4. { :hostname => 'generic2.vagrant', :ip => '172.11.91.220', :box => 'bento/ubuntu-18.04', :ram => '512', :cpus => 1},
  5. { :hostname => 'lighthouse1.vagrant', :ip => '172.11.91.230', :box => 'bento/ubuntu-18.04', :ram => '512', :cpus => 1},
  6. ]
  7. Vagrant.configure("2") do |config|
  8. config.ssh.insert_key = false
  9. if Vagrant.has_plugin?('vagrant-cachier')
  10. config.cache.enable :apt
  11. else
  12. printf("** Install vagrant-cachier plugin to speedup deploy: `vagrant plugin install vagrant-cachier`.**\n")
  13. end
  14. if Vagrant.has_plugin?('vagrant-hostmanager')
  15. config.hostmanager.enabled = true
  16. config.hostmanager.manage_host = true
  17. config.hostmanager.include_offline = true
  18. else
  19. config.vagrant.plugins = "vagrant-hostmanager"
  20. end
  21. nodes.each do |node|
  22. config.vm.define node[:hostname] do |node_config|
  23. node_config.vm.box = node[:box]
  24. node_config.vm.hostname = node[:hostname]
  25. node_config.vm.network :private_network, ip: node[:ip]
  26. node_config.vm.provider :virtualbox do |vb|
  27. vb.memory = node[:ram]
  28. vb.cpus = node[:cpus]
  29. vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  30. vb.customize ['guestproperty', 'set', :id, '/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold', 10000]
  31. end
  32. end
  33. end
  34. end