Reorder organization before hostname

This commit is contained in:
Christer Warén 2023-12-30 14:58:57 +02:00
parent 463588bb31
commit 14f13b8761

36
init.sh
View File

@ -30,24 +30,7 @@ apt-get install -y python3-pip python3-venv jq git curl &> /dev/null
python3 -m venv /opt/ansible &> /dev/null python3 -m venv /opt/ansible &> /dev/null
/opt/ansible/bin/pip3 install ansible hvac netaddr jmespath &> /dev/null /opt/ansible/bin/pip3 install ansible hvac netaddr jmespath &> /dev/null
HOSTNAME=$1 ORG=$1
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
stop
fi
if [[ -z $USER || $USER == "root" ]]; then
if [[ -z $SUDO_USER ]]; then
if [[ -z LOGNAME ]]; then
echo -n ""
else
USER=$LOGNAME
fi
else
USER=$SUDO_USER
fi
fi
ORG=$2
case $ORG in case $ORG in
warengroup) warengroup)
DOMAIN="waren.io" DOMAIN="waren.io"
@ -67,6 +50,23 @@ case $ORG in
;; ;;
esac esac
HOSTNAME=$2
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
stop
fi
if [[ -z $USER || $USER == "root" ]]; then
if [[ -z $SUDO_USER ]]; then
if [[ -z LOGNAME ]]; then
echo -n ""
else
USER=$LOGNAME
fi
else
USER=$SUDO_USER
fi
fi
DEVICE_DOMAIN="devices.$DOMAIN" DEVICE_DOMAIN="devices.$DOMAIN"
IDM_DOMAIN="idm.$DOMAIN" IDM_DOMAIN="idm.$DOMAIN"
VAULT_DOMAIN="vault.cwinfo.net" VAULT_DOMAIN="vault.cwinfo.net"