Code Update

This commit is contained in:
Christer Warén 2024-05-18 00:20:55 +03:00
parent e1a31d2497
commit 32e79f389c
3 changed files with 16 additions and 6 deletions

11
init.sh
View File

@ -30,7 +30,7 @@ wi-init(){
/opt/ansible/bin/pip3 install ansible hvac netaddr jmespath pexpect &> /dev/null /opt/ansible/bin/pip3 install ansible hvac netaddr jmespath pexpect &> /dev/null
curl \ curl \
-H "X-Vault-Token: $VAULT_TOKEN" \ -H "X-Vault-Token: ${config["login",$ORG]}" \
-X GET \ -X GET \
https://$VAULT_DOMAIN/v1/init.sh/data/ssh -s | jq -r '.data.data.privkey' > ~/.ssh/init 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 /opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null
fi fi
GIT_DOMAIN="git.cwinfo.net"
GIT_PORT="2222"
GIT_REPOSITORY="infra-plus"
ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts 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 unset HVT
} }
@ -115,7 +120,7 @@ wi-login(){
FOLDER=$ORG FOLDER=$ORG
DEVICE_DOMAIN="devices.$DOMAIN" DEVICE_DOMAIN="devices.$DOMAIN"
IDM_DOMAIN="idm.$DOMAIN" IDM_DOMAIN="idm.cwinfo.net"
VAULT_DOMAIN="vault.cwinfo.net" VAULT_DOMAIN="vault.cwinfo.net"
if [[ ! -z $2 ]] if [[ ! -z $2 ]]

View File

@ -11,7 +11,7 @@ wi-init(){
/opt/ansible/bin/pip3 install ansible hvac netaddr jmespath pexpect &> /dev/null /opt/ansible/bin/pip3 install ansible hvac netaddr jmespath pexpect &> /dev/null
curl \ curl \
-H "X-Vault-Token: $VAULT_TOKEN" \ -H "X-Vault-Token: ${config["login",$ORG]}" \
-X GET \ -X GET \
https://$VAULT_DOMAIN/v1/init.sh/data/ssh -s | jq -r '.data.data.privkey' > ~/.ssh/init 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 /opt/ansible/bin/ansible-vault encrypt --vault-password-file ~/.ansible/vault.yml ~/.ansible/vars.yml > /dev/null
fi fi
GIT_DOMAIN="git.cwinfo.net"
GIT_PORT="2222"
GIT_REPOSITORY="infra-plus"
ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts 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 /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 unset HVT
} }

View File

@ -49,7 +49,7 @@ wi-login(){
FOLDER=$ORG FOLDER=$ORG
DEVICE_DOMAIN="devices.$DOMAIN" DEVICE_DOMAIN="devices.$DOMAIN"
IDM_DOMAIN="idm.$DOMAIN" IDM_DOMAIN="idm.cwinfo.net"
VAULT_DOMAIN="vault.cwinfo.net" VAULT_DOMAIN="vault.cwinfo.net"
if [[ ! -z $2 ]] if [[ ! -z $2 ]]