# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure(2) do |config| # Filtering gateway of the virtual machine config.vm.define :gateway do |gateway_config| gateway_config.vm.box = "debian/jessie64" gateway_config.vm.host_name = "gateway" gateway_config.vm.network "private_network", ip: "192.168.33.2" gateway_config.vm.synced_folder "salt/", "/srv/salt" # Salt bootstrap needs Python and SSL certificates gateway_config.vm.provision :shell, inline: "sudo apt-get -qq update && sudo apt-get install -qqy python ca-certificates" gateway_config.vm.provision :salt do |salt| salt.minion_config = "saltconfig" salt.install_type = "stable" salt.masterless = true salt.verbose = true salt.colorize = true salt.run_highstate = true # https://github.com/mitchellh/vagrant/issues/5973#issuecomment-137276605 salt.bootstrap_options = "-F -c /tmp/ -P" end end # Test virtual machine to run things config.vm.define :testvm do |testvm_config| testvm_config.vm.box = "debian/jessie64" testvm_config.vm.host_name = "testvm" testvm_config.vm.network "private_network", ip: "192.168.33.10" testvm_config.vm.synced_folder "salt/", "/srv/salt" testvm_config.vm.synced_folder "saltpillar/", "/srv/saltpillar" # Change the default route to the gateway VM # The host may need to adjust its firewall to prevent packets between VMs from being NAT'ed: # iptables -t nat -I POSTROUTING -o 'virbr+' -s 192.168.33.0/24 -j RETURN testvm_config.vm.provision :shell, inline: "sudo ip route delete default ; sudo ip route add default via 192.168.33.2" # Salt bootstrap needs SSL certificates testvm_config.vm.provision :shell, inline: "sudo apt-get -qq update && sudo apt-get install -qqy ca-certificates" testvm_config.vm.provision :salt do |salt| salt.minion_config = "saltconfig" salt.install_type = "stable" salt.masterless = true salt.verbose = true salt.colorize = true salt.run_highstate = true salt.bootstrap_options = "-F -c /tmp/ -P" end end end