Vagrant.require_version ">= 2.0.0" N = 2 Vagrant.configure("2") do |config| (0..N).each do |player_id| vm_name = "mpc-player-#{player_id}" config.vm.define vm_name do |player| player.vm.box = "ubuntu/jammy64" player.vm.hostname = vm_name player.vm.network :private_network, ip: "192.168.56.#{20 + player_id}" player.vm.provider :virtualbox do |vb| vb.cpus = 2 vb.memory = 8192 end if player_id == N player.vm.provision :ansible do |ansible| ansible.limit = "all" ansible.playbook = "playbook.yml" ansible.ask_vault_pass = true end end end end end