38 lines
1.4 KiB
Ruby
38 lines
1.4 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
Vagrant.configure("2") do |config|
|
|
config.vm.provider "libvirt"
|
|
config.vm.box = "tumbleweed-salt"
|
|
config.vm.box_url = "https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/Tumbleweed.x86_64-libvirt.box"
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
# for some reason, Avahi DNS doesn't work until the network stack is restarted
|
|
rcnetwork restart
|
|
SHELL
|
|
config.vm.define "master", primary: true do |master_config|
|
|
master_config.vm.hostname = "salt-master"
|
|
master_config.vm.provider :libvirt do |libvirt|
|
|
libvirt.memory = 768
|
|
end
|
|
master_config.vm.provision "shell", path: "bootstrap-salt-roots.sh"
|
|
master_config.vm.provision "shell", inline: <<-SHELL
|
|
printf 'auto_accept: True\n' > /etc/salt/master.d/notsecure.conf
|
|
printf 'file_roots:\n base:\n - /srv/salt\n - /srv/formulas\n' > /etc/salt/master.d/roots.conf
|
|
systemctl enable --now salt-master
|
|
SHELL
|
|
end
|
|
[
|
|
"minion1",
|
|
"minion2",
|
|
].each do |vmname|
|
|
config.vm.define "#{vmname}" do |minion_config|
|
|
minion_config.vm.synced_folder '.', '/vagrant', disabled: true
|
|
minion_config.vm.hostname = "salt-#{vmname}"
|
|
minion_config.vm.provision "shell", inline: <<-SHELL
|
|
sed -i 's/^#master:.*/master: salt-master/' /etc/salt/minion
|
|
systemctl enable --now salt-minion
|
|
SHELL
|
|
end
|
|
end
|
|
end
|