Skip to content

Instantly share code, notes, and snippets.

@aarontc
Created November 9, 2015 00:01
Show Gist options
  • Save aarontc/c0589dbc507e324fa91c to your computer and use it in GitHub Desktop.
Save aarontc/c0589dbc507e324fa91c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
if [[ $UID -ne '0' ]]; then
echo "Must be root" >&2
exit 1
fi
# Check if minion running
set +e
pgrep salt-minion
x=$?
set -e
if [[ $x -ne '0' ]]; then
set +e
dpkg -l salt-minion >/dev/null 2>&1
x=$?
set -e
if [[ $x -ne '0' ]]; then
echo "Installing salt minion..."
# Set up sources.
wget -O - https://repo.saltstack.com/apt/ubuntu/ubuntu14/latest/SALTSTACK-GPG-KEY.pub | apt-key add -
echo "deb http://repo.saltstack.com/apt/ubuntu/ubuntu14/latest trusty main" > /etc/apt/sources.list.d/salt.list
apt-get update
apt-get -y install salt-minion
fi
#echo "Starting salt minion..."
#update-rc.d salt-minion defaults
#service salt-minion start
else
echo "Salt minion running"
fi
salt-call state.highstate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment