From 8287448fd4851406f97a37afe68203cb507573a2 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Tue, 14 Mar 2023 20:13:22 -0500 Subject: [PATCH] pass master IP as arg to salt bootstrap script This removes the need to hardcode hostnames/IPs in /etc/hosts (Thanks Steven!) --- salt/Vagrantfile | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/salt/Vagrantfile b/salt/Vagrantfile index 8f6bded..1397ea5 100644 --- a/salt/Vagrantfile +++ b/salt/Vagrantfile @@ -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