2014-09-06

Vagrantfile (this is just a bookmark)

This is my (thank you Abel) current Vagrantfile to quickly create a number of servers with two extra disks and three extra network cards:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
 config.vm.provider :virtualbox do |vb|
  vb.customize ["storagectl", :id, "--add", "sata", "--name", "SATA" , "--portcount", 2, "--hostiocache", "on"]
 end
 (1..3).each do |i|
  config.vm.define "server#{i}" do |node|
   node.vm.hostname = "server#{i}"
   node.vm.box = "hfm4/centos7"
   config.vm.box_check_update = true
   node.vm.network :public_network, ip: "10.1.1.#{i}", netmask: '255.255.255.0'
   node.vm.network :public_network, ip: "10.1.2.#{i}", netmask: '255.255.255.0'
   node.vm.network :public_network, ip: "10.1.3.#{i}", netmask: '255.255.255.0'
   config.vm.provider "virtualbox" do |v|
    v.name = "server#{i}"
    v.memory = 512
    v.cpus = 1
    v.customize ['createhd', '--filename', "server_#{i}a.vdi", '--size', 8192 ]
    v.customize ['createhd', '--filename', "server_#{i}b.vdi", '--size', 8192 ]
    v.customize ['storageattach', :id, '--storagectl', 'SATA', '--port', 1, '--device', 0, \
'--type', 'hdd', '--medium', "./server_#{i}a.vdi"]
    v.customize ['storageattach', :id, '--storagectl', 'SATA', '--port', 2, '--device', 0, \
'--type', 'hdd', '--medium', "./server_#{i}b.vdi"]
   end
  end
 end
end


No comments: