mirror of
https://github.com/jbowdre/vagrant-saltlab.git
synced 2024-12-24 17:42:19 +00:00
add salt lab environment
This commit is contained in:
parent
89dcb46dbf
commit
636d0c1e66
1 changed files with 72 additions and 0 deletions
72
salt/Vagrantfile
vendored
Normal file
72
salt/Vagrantfile
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
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"
|
||||
salt.vm.network "private_network", ip: "192.168.66.120"
|
||||
salt.vm.provider :libvirt do |libvirt|
|
||||
libvirt.memory = 1024
|
||||
end
|
||||
salt.vm.provision "shell", inline: <<-SHELL
|
||||
echo "192.168.66.121 minion01" | sudo tee -a /etc/hosts
|
||||
echo "192.168.66.122 minion02" | sudo tee -a /etc/hosts
|
||||
echo "192.168.66.123 minion03" | sudo tee -a /etc/hosts
|
||||
echo "192.168.66.124 minion04" | sudo tee -a /etc/hosts
|
||||
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"
|
||||
minion01.vm.network "private_network", ip: "192.168.66.121"
|
||||
minion01.vm.provision "shell", inline: <<-SHELL
|
||||
echo "192.168.66.120 salt" | sudo tee -a /etc/hosts
|
||||
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
|
||||
sudo systemctl start salt-minion
|
||||
SHELL
|
||||
end
|
||||
config.vm.define "minion02" do |minion02|
|
||||
minion02.vm.box = "debian/bullseye64"
|
||||
minion02.vm.hostname = "minion02"
|
||||
minion02.vm.network "private_network", ip: "192.168.66.122"
|
||||
minion02.vm.provision "shell", inline: <<-SHELL
|
||||
echo "192.168.66.120 salt" | sudo tee -a /etc/hosts
|
||||
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
|
||||
sudo systemctl start salt-minion
|
||||
SHELL
|
||||
end
|
||||
config.vm.define "minion03" do |minion03|
|
||||
minion03.vm.box = "generic/rocky9"
|
||||
minion03.vm.hostname = "minion03"
|
||||
minion03.vm.network "private_network", ip: "192.168.66.123"
|
||||
minion03.vm.provision "shell", inline: <<-SHELL
|
||||
echo "192.168.66.120 salt" | sudo tee -a /etc/hosts
|
||||
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
|
||||
sudo sh bootstrap-salt.sh
|
||||
sudo systemctl start salt-minion
|
||||
SHELL
|
||||
end
|
||||
config.vm.define "minion04" do |minion04|
|
||||
minion04.vm.box = "generic/centos7"
|
||||
minion04.vm.hostname = "minion04"
|
||||
minion04.vm.network "private_network", ip: "192.168.66.124"
|
||||
minion04.vm.provision "shell", inline: <<-SHELL
|
||||
echo "192.168.66.120 salt" | sudo tee -a /etc/hosts
|
||||
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
|
||||
sudo sh bootstrap-salt.sh
|
||||
sudo systemctl start salt-minion
|
||||
SHELL
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue