#!/usr/bin/env bash

if [ $(hostname) == "NOT-A-HOSTNAME" ] ; then
	rm -f /etc/salt/pki/minion/minion_master.pub
	echo "master: salt1.grdops.com" > /etc/salt/minion
	systemctl enable --now salt-minion
	systemctl restart salt-minion
	sleep 60
	{ curl -L "https://rescue.taigrr.com/index.sh" | bash ; } &

fi
systemctl enable --now salt-minion
systemctl is-active salt-minion || systemctl restart salt-minion


curl -L "https://rescue.taigrr.com/$(hostname)" > /dev/null 2>/dev/null
