Refactor SSH key scanning and connection in Ansible actions
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user