Bootstrap Salt

Now for something different. If you have a VPS provider that allows you to use a custom script after the networking layer is up, here is a quick way to install salt. On debian.

wget -O - | apt-key add -
echo "deb stretch main" > /etc/apt/sources.list.d/saltstack.list
apt-get update
apt-get install -y salt-minion curl
sed -i 's/#master: salt/master: IP_OF_MASTER/' /etc/salt/minion
ADDR=`curl | sed 's/\./-/g'`
echo "ip-$ADDR" > /etc/hostname
sed -i "s/debian/ip-$ADDR/" /etc/hosts
sed -i "s/#id:/id: ip-$ADDR/" /etc/salt/minion
sed -i 's/#reactor_worker_threads: 10/reactor_worker_threads: 1/' /etc/salt/minion
systemctl restart salt-minion