|
$num = 6
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
vb.memory=2048
vb.cpus=1
config.vm.box="ubuntu/xenial64"
end
(1..$num).each do |i|
config.vm.define "n#{i}" do |n|
n.vm.network "private_network", ip: "192.168.35.#{10+i}"
n.vm.hostname = "n#{i}"
n.disksize.size = '10GB'
end
end
id_rsa_ssh_key_pub = File.read(File.join(Dir.home, ".ssh", "id_rsa.pub"))
config.vm.provision :shell, :inline => "echo 'Copying local public SSH Key to VM auth_key' && echo '\n' >> /home/ubuntu/.ssh/authorized_keys && echo '#{id_rsa_ssh_key_pub }' >> /home/ubuntu/.ssh/authorized_keys && chmod 600 /home/ubuntu/.ssh/authorized_keys"
config.vm.provision :shell, :inline => "apt-get update -y && apt-get install aptitude -y && aptitude safe-upgrade -y && aptitude install net-tools bind-utils mc htop iftop python -y"
# need for git clone repo
config.ssh.forward_agent = "true"
end
|