From c9887b3a23a012c29f2ce4b1018187ff519a0e94 Mon Sep 17 00:00:00 2001 From: Jay Jahns Date: Fri, 22 Aug 2025 15:56:11 -0500 Subject: [PATCH] Add import_method to module This adds the import method to support web-download option. It has been added to the openstacksdk. Closes-Bug: #2115023 Change-Id: I3236cb50b1265e0d7596ada9122aa3b4fc2baf9e Depends-On: https://review.opendev.org/c/openstack/ansible-collections-openstack/+/955752 --- plugins/modules/image.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/modules/image.py b/plugins/modules/image.py index 44844b2e..006ba8f0 100644 --- a/plugins/modules/image.py +++ b/plugins/modules/image.py @@ -128,6 +128,20 @@ options: - Should only be used when needed, such as when the user needs the cloud to transform image format. type: bool + import_method: + description: + - Method to use for importing the image. Not all deployments support all methods. + - Supports web-download or glance-download. + - copy-image is not supported with create actions. + - glance-direct is removed from the import method so use_import can be used in that case. + type: str + choices: [web-download, glance-download] + uri: + description: + - Required only if using the web-download import method. + - This url is where the data is made available to the Image service. + type: str + extends_documentation_fragment: - openstack.cloud.openstack ''' @@ -399,11 +413,13 @@ class ImageModule(OpenStackModule): visibility=dict(choices=['public', 'private', 'shared', 'community']), volume=dict(), use_import=dict(type='bool'), + import_method=dict(choices=['web-download', 'glance-download']), + uri=dict() ) module_kwargs = dict( mutually_exclusive=[ - ('filename', 'volume'), + ('filename', 'volume', 'uri'), ('visibility', 'is_public'), ], ) @@ -412,7 +428,7 @@ class ImageModule(OpenStackModule): attr_params = ('id', 'name', 'filename', 'disk_format', 'container_format', 'wait', 'timeout', 'is_public', 'is_protected', 'min_disk', 'min_ram', 'volume', 'tags', - 'use_import') + 'use_import', 'import_method', 'uri') def _resolve_visibility(self): """resolve a visibility value to be compatible with older versions"""