I’m trying to connect to a GCP compute instance through IAP. I have a service account with permissions.
I have tried the following
ansible -vvvv GCP -m ping
, which errors because the host name is not found bc I do not have an external ipssh_executeable=wrapper.sh
like hereNumber 2 is almost working but regexing commands are hacky.
Is there a native ansible solution?
Edit: The gcp_compute dynamic inventory does work for pinging instances but it does not work for managing the instances.
Ansible does NOT support package or system management while tunneling through IAP.
(Converting my comment as an answer as requested by OP)
Ansible has a native gce dynamic inventory plugin that you should use to connect to your instances.