Code Update

This commit is contained in:
Christer Warén 2024-05-18 02:16:27 +03:00
parent 32e79f389c
commit a9e0a77f45
3 changed files with 24 additions and 24 deletions

24
init.sh
View File

@ -58,11 +58,11 @@ wi-init(){
GIT_DOMAIN="git.cwinfo.net"
GIT_PORT="2222"
GIT_REPOSITORY="infra-plus"
GIT_REPOSITORY="warengroup/infra-plus"
ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts
export HVT = ${config["login",$ORG]}
export HVT=${config["login",$ORG]}
/opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --vault-password-file ~/.ansible/vault.yml --private-key ~/.ssh/init playbooks/init.yml -t init
@ -77,7 +77,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Hostname Required"
echo "Status: Hostname Required"
wi-stop
fi
@ -97,7 +97,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Organization Required"
echo "Status: Organization Required"
wi-stop
fi
@ -114,7 +114,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Organization Unsupported"
echo "Status: Organization Unsupported"
wi-stop
fi
@ -133,7 +133,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Hostname Required"
echo "Status: Hostname Required"
wi-stop
fi
@ -146,7 +146,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Username Required"
echo "Status: Username Required"
wi-stop
else
USER=$LOGNAME
@ -183,13 +183,13 @@ wi-login(){
if [[ -z $USERNAME || -z $PASSWORD ]]
then
echo -n "Status: Username & Password Required"
echo "Status: Username & Password Required"
wi-stop
else
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then
echo -n "Status: Login Failed"
echo "Status: Login Failed"
wi-stop
fi
@ -208,14 +208,14 @@ wi-login(){
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
then
echo -n "Status: Vault Token Required"
echo "Status: Vault Token Required"
wi-stop
fi
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then
echo -n "Status: Login Failed"
echo "Status: Login Failed"
wi-stop
fi
@ -228,7 +228,7 @@ wi-login(){
echo $wiBold$ORG$wiNormal
echo -n "Status: Vault Offline"
echo "Status: Vault Offline"
wi-stop
fi
}

View File

@ -39,11 +39,11 @@ wi-init(){
GIT_DOMAIN="git.cwinfo.net"
GIT_PORT="2222"
GIT_REPOSITORY="infra-plus"
GIT_REPOSITORY="warengroup/infra-plus"
ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts
export HVT = ${config["login",$ORG]}
export HVT=${config["login",$ORG]}
/opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --vault-password-file ~/.ansible/vault.yml --private-key ~/.ssh/init playbooks/init.yml -t init

View File

@ -6,7 +6,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Hostname Required"
echo "Status: Hostname Required"
wi-stop
fi
@ -26,7 +26,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Organization Required"
echo "Status: Organization Required"
wi-stop
fi
@ -43,7 +43,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Organization Unsupported"
echo "Status: Organization Unsupported"
wi-stop
fi
@ -62,7 +62,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Hostname Required"
echo "Status: Hostname Required"
wi-stop
fi
@ -75,7 +75,7 @@ wi-login(){
echo " >> Login << "
echo "------------------------------"
echo -n "Status: Username Required"
echo "Status: Username Required"
wi-stop
else
USER=$LOGNAME
@ -112,13 +112,13 @@ wi-login(){
if [[ -z $USERNAME || -z $PASSWORD ]]
then
echo -n "Status: Username & Password Required"
echo "Status: Username & Password Required"
wi-stop
else
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then
echo -n "Status: Login Failed"
echo "Status: Login Failed"
wi-stop
fi
@ -137,14 +137,14 @@ wi-login(){
if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]]
then
echo -n "Status: Vault Token Required"
echo "Status: Vault Token Required"
wi-stop
fi
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]
then
echo -n "Status: Login Failed"
echo "Status: Login Failed"
wi-stop
fi
@ -157,7 +157,7 @@ wi-login(){
echo $wiBold$ORG$wiNormal
echo -n "Status: Vault Offline"
echo "Status: Vault Offline"
wi-stop
fi
}