From 32e79f389c4ddae30b790397cc1850ed269e0484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 18 May 2024 00:20:55 +0300 Subject: [PATCH] Code Update --- init.sh | 11 ++++++++--- src/functions/init.sh | 9 +++++++-- src/functions/login.sh | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/init.sh b/init.sh index 82ec661..c21bbc5 100755 --- a/init.sh +++ b/init.sh @@ -30,7 +30,7 @@ wi-init(){ /opt/ansible/bin/pip3 install ansible hvac netaddr jmespath pexpect &> /dev/null curl \ - -H "X-Vault-Token: $VAULT_TOKEN" \ + -H "X-Vault-Token: ${config["login",$ORG]}" \ -X GET \ https://$VAULT_DOMAIN/v1/init.sh/data/ssh -s | jq -r '.data.data.privkey' > ~/.ssh/init @@ -56,10 +56,15 @@ wi-init(){ /opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null fi + GIT_DOMAIN="git.cwinfo.net" + GIT_PORT="2222" + GIT_REPOSITORY="infra-plus" + ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts - /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 + 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 unset HVT } @@ -115,7 +120,7 @@ wi-login(){ FOLDER=$ORG DEVICE_DOMAIN="devices.$DOMAIN" - IDM_DOMAIN="idm.$DOMAIN" + IDM_DOMAIN="idm.cwinfo.net" VAULT_DOMAIN="vault.cwinfo.net" if [[ ! -z $2 ]] diff --git a/src/functions/init.sh b/src/functions/init.sh index 0a22ec7..d99f082 100644 --- a/src/functions/init.sh +++ b/src/functions/init.sh @@ -11,7 +11,7 @@ wi-init(){ /opt/ansible/bin/pip3 install ansible hvac netaddr jmespath pexpect &> /dev/null curl \ - -H "X-Vault-Token: $VAULT_TOKEN" \ + -H "X-Vault-Token: ${config["login",$ORG]}" \ -X GET \ https://$VAULT_DOMAIN/v1/init.sh/data/ssh -s | jq -r '.data.data.privkey' > ~/.ssh/init @@ -37,10 +37,15 @@ wi-init(){ /opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null fi + GIT_DOMAIN="git.cwinfo.net" + GIT_PORT="2222" + GIT_REPOSITORY="infra-plus" + ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts + 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 - unset HVT } diff --git a/src/functions/login.sh b/src/functions/login.sh index 13c1a5c..1592985 100644 --- a/src/functions/login.sh +++ b/src/functions/login.sh @@ -49,7 +49,7 @@ wi-login(){ FOLDER=$ORG DEVICE_DOMAIN="devices.$DOMAIN" - IDM_DOMAIN="idm.$DOMAIN" + IDM_DOMAIN="idm.cwinfo.net" VAULT_DOMAIN="vault.cwinfo.net" if [[ ! -z $2 ]]