Refactor SSH key scanning and connection in Ansible actions

This commit is contained in:
2024-10-06 14:37:58 +02:00
parent b0a0e4ea4d
commit f235dea2af
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ runs:
IP_ADDR=$(ansible -i inventory/hosts -u $ANSIBLE_USER -m shell -a "curl -s ifconfig.me" $K8S_TARGET | grep -oP '(\d+\.){3}\d+')
# Forward the k8s API server port to localhost
ssh -f -N -L 16443:localhost:16443 $ANSIBLE_USER@$ANSIBLE_HOST
ssh -f -N -L 16443:localhost:16443 "$ANSIBLE_USER@$ANSIBLE_HOST"
# Override the kube config file to use localhost
sed -i "s/server: https:\/\/$IP_ADDR:16443/server: https:\/\/localhost:16443/g" ~/.kube/config