Skip to content

Instantly share code, notes, and snippets.

@fabioabreureis
Created March 28, 2023 23:13
Show Gist options
  • Save fabioabreureis/5aae5c0477aa28e3771f7bba5a929df1 to your computer and use it in GitHub Desktop.
Save fabioabreureis/5aae5c0477aa28e3771f7bba5a929df1 to your computer and use it in GitHub Desktop.
routerosimg = 'cheretbe/routeros'
clientsimg = 'gusztavvargadr/ubuntu-desktop'
serversimg = 'generic/rocky8'
nodes = [ { :hostname => 'client1', :imgversion => "#{clientsimg}",:ip => "#{network}.102", :ram => 1024 },
{ :hostname => 'client2', :imgversion => "#{clientsimg}" , :ip => "#{network}.103", :ram => 1024 },
{ :hostname => 'server1', :imgversion => "#{serversimg}", :ip => "#{network}.104", :ram => 1024 }]
Vagrant.configure("2") do |config|
config.vm.define "routeros1" do |router|
router.vm.box = "cheretbe/routeros"
router.vm.hostname = "routeros1"
router.vm.provision "routeros_command", name: "Teste", command: "/system resource print"
router.vm.network "private_network", virtualbox__intnet: "vagrant-intnet-1", auto_config: false
router.vm.network "private_network", virtualbox__intnet: "vagrant-intnet-2", auto_config: false
end
end
Vagrant.configure("2") do |config|
nodes.each do |node|
config.vm.define node[:hostname] do |nodeconfig|
nodeconfig.vm.box = node[:imgversion]
nodeconfig.vm.hostname = node[:hostname]
nodeconfig.vm.network "private_network", virtualbox__intnet: "vagrant-intnet-1", auto_config: false
nodeconfig.vm.network "private_network", virtualbox__intnet: "vagrant-intnet-2", auto_config: false
memory = node[:ram] ? node[:ram] : 512;
cpu = node[:cpu] ? node[:cpu] : 1;
nodeconfig.vm.provider :virtualbox do |vb|
vb.customize [ "modifyvm", :id, "--memory", memory.to_s,]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment