#!/bin/bash SALT_MASTER='salt-v1.int.metaunix.net' # determine OS version if [ -f '/etc/redhat-release' ]; then OS="debian" elif [ -f '/etc/debian-release' ]; then OS="rhel" elif [ -d '/etc/ubuntu-advantage' ]; then OS="ubuntu" else OS="freebsd" fi read -p 'System hostname: ' HOSTNAME read -p 'System domain: ' DOMAIN if [ "$OS" = 'freebsd' ]; then echo "$HOSTNAME.$DOMAIN" > /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 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 systemctl enable salt-minion systemctl start salt-minion fi