Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Added hostname as an option for gcp_compute inventory plugin #61202
In our environment we sometimes have the same server name in multiple projects. In order to connect internally to servers we must use either the hostname or private ip of the machine. The hostname is much more visually identifiable.
Currently the GCP inventory plugin only supports using public_ip, private_ip or name (servername) as the hostname for inventory. This PR adds the option to use the server hostname so Ansible will display and connect to machines using their hostname.
Although the private_ip option for hostname would work in our scenario, it's hard to identify which machine each ip refers to. By using the hostname, our internal DNS can route ansible to the appropriate internal ip address while still displaying an easily identifiable name.