This commit is contained in:
Christer Warén 2024-06-01 15:59:50 +03:00
parent 9387e15062
commit 352b7b2325
8 changed files with 25 additions and 34 deletions

29
init.sh
View File

@ -17,27 +17,27 @@ wiBold=$(tput bold)
wiNormal=$(tput sgr0) wiNormal=$(tput sgr0)
wi-header(){ wi-header(){
wx-header $1 $2 wx-header "$1" $2
} }
wi-repeat(){ wi-repeat(){
wx-repeat $1 $2 wx-repeat "$1" "$2"
} }
wi-login(){ wi-login(){
wx-login $1 $2 wx-login "$1" "$2"
}
wx-start(){
wi-start
} }
wx-stop(){ wx-stop(){
wi-stop wi-stop
} }
wi-delete(){ wxBold=$wiBold
if [[ -f "init.sh" ]] wxNormal=$wiNormal
then
rm init.sh
fi
}
wx-header(){ wx-header(){
if [[ $2 == "h1" ]] if [[ $2 == "h1" ]]
@ -109,7 +109,7 @@ wi-init(){
export HVT=${config["login",$ORG]} export HVT=${config["login",$ORG]}
/opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.docker community.general community.hashi_vault community.libvirt community.mysql community.postgresql containers.podman --upgrade /opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.docker community.general community.hashi_vault community.libvirt community.mysql community.postgresql containers.podman --upgrade &> /dev/null
/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 /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
@ -117,8 +117,6 @@ wi-init(){
} }
wx-login(){ wx-login(){
ORG=$1
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]] if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]
then then
wx-header "Login" wx-header "Login"
@ -299,7 +297,7 @@ wx-repeat() {
wi-restricted(){ wi-restricted(){
if [[ $USER != "root" && $USER != "local" ]] if [[ $USER != "root" && $USER != "local" ]]
then then
sudo $0 $1 $2 sudo $1
exit 1 exit 1
fi fi
} }
@ -313,13 +311,10 @@ wi-stop (){
echo " " echo " "
echo " " echo " "
wi-delete
exit 1 exit 1
} }
wi-start wi-restricted "$0 $1 $2"
wi-restricted $0 $1 $2
wi-init $1 $2 wi-init $1 $2
wi-stop wi-stop

View File

@ -18,7 +18,6 @@ wiNormal=$(tput sgr0)
{{ CODES }} {{ CODES }}
wi-start wi-restricted "$0 $1 $2"
wi-restricted $0 $1 $2
wi-init $1 $2 wi-init $1 $2
wi-stop wi-stop

View File

@ -1,15 +1,22 @@
wi-header(){ wi-header(){
wx-header $1 $2 wx-header "$1" "$2"
} }
wi-repeat(){ wi-repeat(){
wx-repeat $1 $2 wx-repeat "$1" "$2"
} }
wi-login(){ wi-login(){
wx-login $1 $2 wx-login "$1" "$2"
}
wx-start(){
wi-start
} }
wx-stop(){ wx-stop(){
wi-stop wi-stop
} }
wxBold=$wiBold
wxNormal=$wiNormal

View File

@ -1,6 +0,0 @@
wi-delete(){
if [[ -f "init.sh" ]]
then
rm init.sh
fi
}

View File

@ -43,7 +43,7 @@ wi-init(){
export HVT=${config["login",$ORG]} export HVT=${config["login",$ORG]}
/opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.docker community.general community.hashi_vault community.libvirt community.mysql community.postgresql containers.podman --upgrade /opt/ansible/bin/ansible-galaxy collection install ansible.posix ansible.utils community.crypto community.docker community.general community.hashi_vault community.libvirt community.mysql community.postgresql containers.podman --upgrade &> /dev/null
/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 /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

@ -1,6 +1,4 @@
wx-login(){ wx-login(){
ORG=$1
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]] if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]
then then
wx-header "Login" wx-header "Login"

View File

@ -1,7 +1,7 @@
wi-restricted(){ wi-restricted(){
if [[ $USER != "root" && $USER != "local" ]] if [[ $USER != "root" && $USER != "local" ]]
then then
sudo $0 $1 $2 sudo $1
exit 1 exit 1
fi fi
} }

View File

@ -3,7 +3,5 @@ wi-stop (){
echo " " echo " "
echo " " echo " "
wi-delete
exit 1 exit 1
} }