diff --git a/init.sh b/init.sh index f4433a4..46e071b 100755 --- a/init.sh +++ b/init.sh @@ -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 diff --git a/src/base.sh b/src/base.sh index 1239746..e0ef65b 100644 --- a/src/base.sh +++ b/src/base.sh @@ -32,5 +32,5 @@ then apt install -y jq &> /dev/null fi -wi-init $1 $2 +wi-init $1 $2 $3 wi-stop diff --git a/src/functions/init.sh b/src/functions/init.sh index a6ca65a..9cbf9c9 100644 --- a/src/functions/init.sh +++ b/src/functions/init.sh @@ -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