Add Type question to Init script

This commit is contained in:
Christer Warén
2025-08-30 12:50:51 +03:00
parent ff4bebdc53
commit 17cb8fe954
3 changed files with 32 additions and 2 deletions

17
init.sh
View File

@@ -87,6 +87,20 @@ wi-init(){
wx-stop
fi
if [[ ! -z $3 ]]
then
if [[ $3 == "server" || $3 == "workstation" ]]
then
TYPE="$3"
else
echo "Status: Type Invalid"
wx-stop
fi
else
echo "Status: Type Required"
wx-stop
fi
mkdir -p ~/.ssh/keys &> /dev/null
apt-get update &> /dev/null
@@ -110,6 +124,7 @@ wi-init(){
then
echo "---" > ~/.ansible/vars.yml
echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml
echo "type: $TYPE" >> ~/.ansible/vars.yml
echo "config:" >> ~/.ansible/vars.yml
echo " identity:" >> ~/.ansible/vars.yml
echo " vault:" >> ~/.ansible/vars.yml
@@ -331,5 +346,5 @@ then
apt install -y jq &> /dev/null
fi
wi-init $1 $2
wi-init $1 $2 $3
wi-stop

View File

@@ -32,5 +32,5 @@ then
apt install -y jq &> /dev/null
fi
wi-init $1 $2
wi-init $1 $2 $3
wi-stop

View File

@@ -13,6 +13,20 @@ wi-init(){
wx-stop
fi
if [[ ! -z $3 ]]
then
if [[ $3 == "server" || $3 == "workstation" ]]
then
TYPE="$3"
else
echo "Status: Type Invalid"
wx-stop
fi
else
echo "Status: Type Required"
wx-stop
fi
mkdir -p ~/.ssh/keys &> /dev/null
apt-get update &> /dev/null
@@ -36,6 +50,7 @@ wi-init(){
then
echo "---" > ~/.ansible/vars.yml
echo "hostname: $HOSTNAME" >> ~/.ansible/vars.yml
echo "type: $TYPE" >> ~/.ansible/vars.yml
echo "config:" >> ~/.ansible/vars.yml
echo " identity:" >> ~/.ansible/vars.yml
echo " vault:" >> ~/.ansible/vars.yml