Update strap.sh

This commit is contained in:
colin 2024-12-03 16:49:54 -05:00
parent 8d69525d06
commit 1d31ffb6f5
1 changed files with 25 additions and 14 deletions

View File

@ -3,30 +3,41 @@
# Define the Salt Master address
SALT_MASTER="ingress.nixc.us"
# Step 1: Download the Salt Bootstrap Script
# Step 1: Ensure /etc/salt/minion.d/ directory exists
echo "Ensuring /etc/salt/minion.d/ directory exists..."
mkdir -p /etc/salt/minion.d
# Step 2: Add configuration for the master in minion.d
echo "Adding master configuration to /etc/salt/minion.d/master.conf..."
cat <<EOF > /etc/salt/minion.d/master.conf
master: $SALT_MASTER
EOF
# Add additional configuration files as needed
echo "Adding custom configurations..."
cat <<EOF > /etc/salt/minion.d/custom.conf
# Example custom configuration
grains:
roles:
- webserver
EOF
# Step 3: Download the Salt Bootstrap Script
echo "Downloading Salt Bootstrap Script..."
curl -L https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.sh -o /tmp/install_salt.sh
# Step 2: Make the script executable
# Step 4: Make the script executable
chmod +x /tmp/install_salt.sh
# Step 3: Run the Bootstrap Script with specified options
# Step 5: Run the Bootstrap Script with specified options
echo "Installing Salt Minion and configuring master..."
sh /tmp/install_salt.sh -A "$SALT_MASTER" -P -x python3 stable
# Step 4: Verify the Salt Minion Configuration
if grep -q "master: $SALT_MASTER" /etc/salt/minion; then
echo "Salt Minion successfully configured to connect to master: $SALT_MASTER"
else
echo "Error: Salt Minion configuration failed. Please check manually."
exit 1
fi
# Step 5: Restart the Salt Minion service
# Step 6: Restart the Salt Minion service
echo "Restarting Salt Minion service..."
systemctl restart salt-minion
# Step 6: Check Salt Minion service status
# Step 7: Check Salt Minion service status
echo "Checking Salt Minion service status..."
systemctl status salt-minion --no-pager