Created
March 28, 2023 23:13
-
-
Save fabioabreureis/5aae5c0477aa28e3771f7bba5a929df1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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