diff --git a/changelogs/fragments/42042-inventory_with_no_region.yaml b/changelogs/fragments/42042-inventory_with_no_region.yaml new file mode 100644 index 00000000000..65ed6458fd6 --- /dev/null +++ b/changelogs/fragments/42042-inventory_with_no_region.yaml @@ -0,0 +1,2 @@ +bugfixes: +- plugins/inventory/openstack.py - Do not create group with empty name if region is not set diff --git a/lib/ansible/plugins/inventory/openstack.py b/lib/ansible/plugins/inventory/openstack.py index b2ad6c2ebd3..6105a883951 100644 --- a/lib/ansible/plugins/inventory/openstack.py +++ b/lib/ansible/plugins/inventory/openstack.py @@ -258,7 +258,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): groups.append(cloud) # Create a group on region - groups.append(region) + if region: + groups.append(region) # And one by cloud_region groups.append("%s_%s" % (cloud, region))