vagrant-salt-environment/Vagrantfile

69 lines
2.5 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Use this box as base for all machines
config.vm.box = "debian/buster64"
# Define primary salt-master vm
config.vm.define "salt-master", primary: true do |master|
master.vm.hostname = "salt-master"
# Define network for salt management
master.vm.network "private_network", ip: "10.254.254.2", virtualbox__intnet: "salt-management"
# Sync salt pillar + state files here
master.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [".git/",]
# Provide dependencies (also for gitfs)
master.vm.provision :shell, :inline => "sudo apt-get -y install git-core python3-pygit2 python3-setuptools python3-tornado"
# Symlink states + pillar to /srv
master.vm.provision :shell, :inline => "ln -s /vagrant/saltstack/salt /srv/"
master.vm.provision :shell, :inline => "ln -s /vagrant/saltstack/pillar /srv/"
# Use vagrant salt provisioner (uses most recent salt-bootstrap script)
# See https://www.vagrantup.com/docs/provisioning/salt.html
master.vm.provision :salt do |salt|
salt.bootstrap_options = '-F -c /tmp/ -P -x python3'
salt.colorize = true
salt.install_master = true
salt.minion_config = "saltstack/config/minion-master"
salt.master_config = "saltstack/config/master"
salt.verbose = true
end
master.vm.provision :shell, :inline => "echo salt-master is up!"
master.vm.provision :shell, :inline => "ip addr show"
end # config.vm.define "salt-master"
# Define two salt-minion vms
(1..2).each do |i|
config.vm.define "salt-minion-#{i}" do |minion|
minion.vm.hostname = "salt-minion-#{i}"
# Define network for salt management
minion.vm.network "private_network", ip: "10.254.254.2#{i}", virtualbox__intnet: "salt-management"
# Use vagrant salt provisioner (uses most recent salt-bootstrap script)
# See https://www.vagrantup.com/docs/provisioning/salt.html
minion.vm.provision :salt do |salt|
salt.bootstrap_options = '-F -c /tmp/ -P -x python3'
salt.colorize = true
salt.install_master = false
salt.masterless = false
salt.minion_config = "saltstack/config/minion-#{i}"
salt.verbose = true
end
minion.vm.provision :shell, :inline => "echo salt-minion #{i} is up!"
minion.vm.provision :shell, :inline => "ip addr show"
end # config.vm.define "salt-minion-#{i}"
end # (1..2).each do |i|
end # Vagrant.configure