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 0000000000..65ed6458fd --- /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 b2ad6c2ebd..6105a88395 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))