Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. domain = 'example.com'
  2.  
  3. nodes = [
  4. { hostname: 'lb01', ip: '192.168.250.10', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
  5. { hostname: 'node01', ip: '192.168.250.21', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
  6. { hostname: 'node02', ip: '192.168.250.22', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
  7. { hostname: 'node03', ip: '192.168.250.23', box: 'ubuntu/bionic64', cpus: '1', ram: '256' },
  8. ]
  9.  
  10. Vagrant.configure('2') do |config|
  11. nodes.each do |node|
  12. config.vm.define node[:hostname] do |nodeconfig|
  13. nodeconfig.vm.box = node[:box] ? node[:box] : 'ubuntu/trusty64'
  14. nodeconfig.ssh.insert_key = false
  15. nodeconfig.vm.hostname = node[:hostname] + '.' + domain
  16. nodeconfig.vm.network :private_network, ip: node[:ip]
  17.  
  18. cpus = node[:cpus] ? node[:cpus] : 1
  19. memory = node[:ram] ? node[:ram] : 256
  20. nodeconfig.vm.provider :virtualbox do |vb|
  21. vb.customize [
  22. 'modifyvm', :id,
  23. '--cpuexecutioncap', '100',
  24. '--cpus', cpus.to_s,
  25. '--memory', memory.to_s
  26. ]
  27. end
  28. end
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement