Commit 9ac3381e authored by Peter Niederlag's avatar Peter Niederlag
Browse files

[TASK] set server name as argument on call time

parent 396ccd4d
......@@ -8,6 +8,21 @@ fi
source $MACHINE_CONF_FILE
if [ -z "$1" ]; then
echo "you must supply server name like srvXXX as argument"
exit 99
else
SERVER_NAME=$1
SERVER_IPV4_ADDRESS=$(echo "$SERVER_NAME" | sed -r -n 's/(srv)([0-9]{3})/\2/p')
if [[ ! "$SERVER_IPV4_ADDRESS" =~ ^[0-9]{3}$ ]]; then
echo "Could not validate $SERVER_IPV4_ADDRESS"
exit 99
else
NET_IPV4_ADDRESS="$SERVER_IPV4_BLOCK.$SERVER_IPV4_ADDRESS"
fi
fi
# we should now have the following variables
echo "SERVER_NAME $SERVER_NAME"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment