Open
Description
SUMMARY
The gcp_compute inventory allows you to use labels as name.
However once specified it requires all compute instances to have at least one label.
This should not be a requirement. If the label is not available, it should go with the next specified ordering. If not labels at all are present, it should have the same behavior.
ISSUE TYPE
- Bug Report
COMPONENT NAME
gcp_compute.py inventory plugin
ANSIBLE VERSION
ansible 2.10.17
config file = /tmp/tmp7wm48acw/ansible.cfg
configured module search path = ['/tmp/tmp7wm48acw/.library']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.9.3 (default, Apr 2 2021, 21:01:41) [GCC 8.3.0]
COLLECTION VERSION
** sidenote inventory is pinned to git commit ec093086ab2b7ab203e23e1d45ba7944a737f7b8
# /root/.ansible/collections/ansible_collections
Collection Version
------------ -------
google.cloud 1.0.2
# /usr/local/lib/python3.9/site-packages/ansible_collections
Collection Version
------------ -------
google.cloud 1.0.2
OS / ENVIRONMENT
STEPS TO REPRODUCE
1 - Create a vm without any labels
2 - Add labels.name (or another label) to the hostnames entry in the inventory
EXPECTED RESULTS
The VM without any labels should use the next entry in the hostname section if no labels are present
ACTUAL RESULTS
The inventory stops parsing
[WARNING]: * Failed to parse /tmp/tmp7wm48acw/inventory/gcp/us_east1.gcp.yml with ansible_collections.google.cloud.plugins.inventory.gcp_compute plugin: 'labels'
Metadata
Metadata
Assignees
Labels
No labels