pass master IP as arg to salt bootstrap script

This removes the need to hardcode hostnames/IPs in /etc/hosts

(Thanks Steven!)
This commit is contained in:
John Bowdre 2023-03-14 20:13:22 -05:00
parent cd603f2228
commit 8287448fd4

16
salt/Vagrantfile vendored
View file

@ -14,10 +14,6 @@ Vagrant.configure("2") do |config|
libvirt.memory = 1024
end
salt.vm.provision "shell", inline: <<-SHELL
echo "192.168.100.121 minion01" | sudo tee -a /etc/hosts
echo "192.168.100.122 minion02" | sudo tee -a /etc/hosts
echo "192.168.100.123 minion03" | sudo tee -a /etc/hosts
echo "192.168.100.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
@ -31,11 +27,10 @@ Vagrant.configure("2") do |config|
minion01.vm.hostname = "minion01"
minion01.vm.network "private_network", ip: "192.168.100.121"
minion01.vm.provision "shell", inline: <<-SHELL
echo "192.168.100.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 sh bootstrap-salt.sh -A 192.168.100.120
sudo systemctl start salt-minion
SHELL
end
@ -44,11 +39,10 @@ Vagrant.configure("2") do |config|
minion02.vm.hostname = "minion02"
minion02.vm.network "private_network", ip: "192.168.100.122"
minion02.vm.provision "shell", inline: <<-SHELL
echo "192.168.100.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 sh bootstrap-salt.sh -A 192.168.100.120
sudo systemctl start salt-minion
SHELL
end
@ -57,9 +51,8 @@ Vagrant.configure("2") do |config|
minion03.vm.hostname = "minion03"
minion03.vm.network "private_network", ip: "192.168.100.123"
minion03.vm.provision "shell", inline: <<-SHELL
echo "192.168.100.120 salt" | sudo tee -a /etc/hosts
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
sudo sh bootstrap-salt.sh
sudo sh bootstrap-salt.sh -A 192.168.100.120
sudo systemctl start salt-minion
SHELL
end
@ -68,9 +61,8 @@ Vagrant.configure("2") do |config|
minion04.vm.hostname = "minion04"
minion04.vm.network "private_network", ip: "192.168.100.124"
minion04.vm.provision "shell", inline: <<-SHELL
echo "192.168.100.120 salt" | sudo tee -a /etc/hosts
curl -o bootstrap-salt.sh -L https://bootstrap.saltproject.io
sudo sh bootstrap-salt.sh
sudo sh bootstrap-salt.sh -A 192.168.100.120
sudo systemctl start salt-minion
SHELL
end