Fixed hostname setting and salt config in initial-setup script

This commit is contained in:
Gregory Ballantine 2024-04-22 23:42:17 -04:00
parent 060c35058d
commit d8fea80ded

View File

@ -17,17 +17,28 @@ read -p 'System hostname: ' HOSTNAME
read -p 'System domain: ' DOMAIN
if [ "$OS" = 'freebsd' ]; then
echo "$HOSTNAME.$DOMAIN" > /usr/local/etc/salt/minion_id
# Configure system hostname
sysrc hostname="$HOSTNAME.$DOMAIN"
# Configure salt
echo "$HOSTNAME" > /usr/local/etc/salt/minion_id
sed -i .orig "s/\#master: salt/master: $SALT_MASTER/" /usr/local/etc/salt/minion
rm -rf /usr/local/etc/salt/pki
# Enable and start salt
sysrc salt_minion_enable="YES"
service salt_minion start
else
echo "$HOSTNAME.$DOMAIN" > /etc/salt/minion_id
sed -i "s/\#master: salt/master: $SALT_MASTER/" /etc/salt/minion
rm -rf /etc/salt/pki
# Configure system hostname
hostnamectl set-hostname "$HOSTNAME"
systemctl enable salt-minion
# Configure salt
echo "$HOSTNAME" > /etc/salt/minion_id
sed -i "s/\#master: salt/master: $SALT_MASTER/" /etc/salt/minion
# Enable and start salt
systemctl stop salt-minion
rm -rf /etc/salt/pki
systemctl start salt-minion
systemctl enable salt-minion
fi