`
Hi Ansible community,
I’m having trouble with dynamic inventory in AWX. I’m trying to create Ansible inventory groups based on instance tags. I’m configuring the inventory plugin using Source Variables in AWX.
My inventory configuration (in Source Variables) includes something like this to group by tags:
plugin: gcp_compute
projects:
- your-gcp-project-id # (My project ID)
auth_kind: application # (Or serviceaccount)
hostnames:
- name
keyed_groups:
- key: tags.items
prefix: tag
But I get this error:
[WARNING]: * Failed to parse /runner/inventory/gcp_compute.yml with auto
plugin: Invalid group name format, expected a string or a list of them or
dictionary, got: <class 'builtin_function_or_method'>
I’ve checked:
- YAML syntax (it’s valid)
- GCP tag data:
tags.items
is a list of strings (e.g.,["web", "db"]
)
My setup:
- Ansible version: (e.g., 2.15.12)
google.cloud
collection: (e.g., 1.3.0 or 1.5.0)- AWX on GKE
Why am I getting this error, and how can I create groups from my GCP instance tags?
Thanks for any help!