AWX GCP Dynamic Inventory

, ,

Has anyone figured out a way to get GCP Dynamic Inventory to use gce_private_ip as the “ansible_ssh_host”? It will default to the external IP address while pulling the inventory and set the eIP as the ansible_ssh_host.

This can be accomplished easily with the AWS dynamic inventory by adding destination_variable to the “source variables” section. GCP Dynamic Inventory does not have the same feature.

Here is what I use for my inventory, which will set it to name the inventory using the machine name, and then use the internal IP for connectivity: