Refactor Terraform Apply script to use IP address instead of hostname in kube config
This commit is contained in:
@@ -95,8 +95,8 @@ jobs:
|
||||
run: |
|
||||
for HOST in $TRUSTED_HOSTS; do
|
||||
ssh -f -N -L 16443:localhost:16443 $ANSIBLE_USER@$HOST
|
||||
# override hosts address in kube config
|
||||
sed -i "s/server: https:\/\/$HOST:16443/server: https:\/\/localhost:16443/g" ~/.kube/config
|
||||
IP_ADDR=$(ssh $ANSIBLE_USER@$HOST "hostname -I | cut -d' ' -f1")
|
||||
sed -i "s/server: https:\/\/$IP_ADDR:16443/server: https:\/\/localhost:16443/g" ~/.kube/config
|
||||
cd terraform/k8sapps
|
||||
sectool exec terraform apply --auto-approve
|
||||
pkill -f "ssh -f -N -L 16443:localhost:16443 $ANSIBLE_USER@$HOST"
|
||||
|
||||
Reference in New Issue
Block a user