| 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
| 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure |
| 5 | # configures the configuration version (we support older styles for |
| 6 | # backwards compatibility). Please don't change it unless you know what |
| 7 | # you're doing. |
| 8 | Vagrant.configure(2) do |config| |
| 9 | # Filtering gateway of the virtual machine |
| 10 | config.vm.define :gateway do |gateway_config| |
| 11 | gateway_config.vm.box = "debian/jessie64" |
| 12 | gateway_config.vm.host_name = "gateway" |
| 13 | gateway_config.vm.network "private_network", ip: "192.168.33.2" |
| 14 | gateway_config.vm.synced_folder "salt/", "/srv/salt" |
| 15 | |
| 16 | gateway_config.vm.provision :salt do |salt| |
| 17 | salt.minion_config = "saltconfig" |
| 18 | salt.install_type = "stable" |
| 19 | salt.masterless = true |
| 20 | salt.verbose = true |
| 21 | salt.colorize = true |
| 22 | # https://github.com/mitchellh/vagrant/issues/5973#issuecomment-137276605 |
| 23 | salt.bootstrap_options = "-F -c /tmp/ -P" |
| 24 | end |
| 25 | end |
| 26 | |
| 27 | # Test virtual machine to run things |
| 28 | config.vm.define :testvm do |testvm_config| |
| 29 | testvm_config.vm.box = "debian/jessie64" |
| 30 | testvm_config.vm.host_name = "testvm" |
| 31 | testvm_config.vm.network "private_network", ip: "192.168.33.10" |
| 32 | testvm_config.vm.synced_folder "salt/", "/srv/salt" |
| 33 | testvm_config.vm.synced_folder "saltpillar/", "/srv/saltpillar" |
| 34 | |
| 35 | # Change the default route to the gateway VM |
| 36 | testvm_config.vm.provision "shell", |
| 37 | inline: "sudo ip route delete default ; sudo ip route add default via 192.168.33.2" |
| 38 | |
| 39 | testvm_config.vm.provision :salt do |salt| |
| 40 | salt.minion_config = "saltconfig" |
| 41 | salt.install_type = "stable" |
| 42 | salt.masterless = true |
| 43 | salt.verbose = true |
| 44 | salt.colorize = true |
| 45 | salt.bootstrap_options = "-F -c /tmp/ -P" |
| 46 | end |
| 47 | end |
| 48 | end |