2023-03-14 18:58:52 +00:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
|
|
|
# Salt lab environment with one master and four minions
|
|
|
|
|
2023-03-14 03:08:57 +00:00
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
config.nfs.verify_installed = false
|
|
|
|
config.vm.synced_folder '.', '/vagrant', type: 'rsync'
|
|
|
|
config.vm.define "salt", primary: true do |salt|
|
|
|
|
salt.vm.box = "peru/ubuntu-20.04-server-amd64"
|
|
|
|
salt.vm.hostname = "salt"
|
2023-03-14 18:58:52 +00:00
|
|
|
salt.vm.network "private_network", ip: "192.168.100.120"
|
2023-03-14 03:08:57 +00:00
|
|
|
salt.vm.provider :libvirt do |libvirt|
|
|
|
|
libvirt.memory = 1024
|
|
|
|
end
|
|
|
|
salt.vm.provision "shell", inline: <<-SHELL
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install curl -y
|
|
|
|
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
|
|
|
|
sudo sh bootstrap-salt.sh -M
|
|
|
|
sudo systemctl start salt-master
|
|
|
|
sudo systemctl start salt-minion
|
|
|
|
SHELL
|
|
|
|
end
|
|
|
|
config.vm.define "minion01" do |minion01|
|
|
|
|
minion01.vm.box = "peru/ubuntu-20.04-server-amd64"
|
|
|
|
minion01.vm.hostname = "minion01"
|
2023-03-14 18:58:52 +00:00
|
|
|
minion01.vm.network "private_network", ip: "192.168.100.121"
|
2023-03-14 03:08:57 +00:00
|
|
|
minion01.vm.provision "shell", inline: <<-SHELL
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install curl -y
|
|
|
|
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
|
2023-03-15 01:13:22 +00:00
|
|
|
sudo sh bootstrap-salt.sh -A 192.168.100.120
|
2023-03-14 03:08:57 +00:00
|
|
|
sudo systemctl start salt-minion
|
|
|
|
SHELL
|
|
|
|
end
|
|
|
|
config.vm.define "minion02" do |minion02|
|
|
|
|
minion02.vm.box = "debian/bullseye64"
|
|
|
|
minion02.vm.hostname = "minion02"
|
2023-03-14 18:58:52 +00:00
|
|
|
minion02.vm.network "private_network", ip: "192.168.100.122"
|
2023-03-14 03:08:57 +00:00
|
|
|
minion02.vm.provision "shell", inline: <<-SHELL
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install curl -y
|
|
|
|
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
|
2023-03-15 01:13:22 +00:00
|
|
|
sudo sh bootstrap-salt.sh -A 192.168.100.120
|
2023-03-14 03:08:57 +00:00
|
|
|
sudo systemctl start salt-minion
|
|
|
|
SHELL
|
|
|
|
end
|
|
|
|
config.vm.define "minion03" do |minion03|
|
|
|
|
minion03.vm.box = "generic/rocky9"
|
|
|
|
minion03.vm.hostname = "minion03"
|
2023-03-14 18:58:52 +00:00
|
|
|
minion03.vm.network "private_network", ip: "192.168.100.123"
|
2023-03-14 03:08:57 +00:00
|
|
|
minion03.vm.provision "shell", inline: <<-SHELL
|
|
|
|
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
|
2023-03-15 01:13:22 +00:00
|
|
|
sudo sh bootstrap-salt.sh -A 192.168.100.120
|
2023-03-14 03:08:57 +00:00
|
|
|
sudo systemctl start salt-minion
|
|
|
|
SHELL
|
|
|
|
end
|
|
|
|
config.vm.define "minion04" do |minion04|
|
|
|
|
minion04.vm.box = "generic/centos7"
|
|
|
|
minion04.vm.hostname = "minion04"
|
2023-03-14 18:58:52 +00:00
|
|
|
minion04.vm.network "private_network", ip: "192.168.100.124"
|
2023-03-14 03:08:57 +00:00
|
|
|
minion04.vm.provision "shell", inline: <<-SHELL
|
|
|
|
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
|
2023-03-15 01:13:22 +00:00
|
|
|
sudo sh bootstrap-salt.sh -A 192.168.100.120
|
2023-03-14 03:08:57 +00:00
|
|
|
sudo systemctl start salt-minion
|
|
|
|
SHELL
|
|
|
|
end
|
|
|
|
end
|
2023-03-14 18:58:52 +00:00
|
|
|
|