From 71216cace54d7f53c5eba288931b6145accf61b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ne=C4=8Das?= Date: Mon, 1 Apr 2019 13:25:36 +0200 Subject: [PATCH] add ovirt template clone name (#54596) * add ovirt template clone name * ovirt template clone name update docs --- lib/ansible/modules/cloud/ovirt/ovirt_template.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_template.py b/lib/ansible/modules/cloud/ovirt/ovirt_template.py index 8e60a114740..e8e4e38f284 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_template.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_template.py @@ -179,6 +179,11 @@ options: - Upper bound of template memory up to which memory hot-plug can be performed. Prefix uses IEC 60027-2 standard (for example 1GiB, 1024MiB). version_added: "2.6" + clone_name: + description: + - Name for importing Template from storage domain. + - If not defined, C(name) will be used. + version_added: "2.8" extends_documentation_fragment: ovirt ''' @@ -476,6 +481,7 @@ def main(): export_domain=dict(default=None), storage_domain=dict(default=None), exclusive=dict(type='bool'), + clone_name=dict(default=None), image_provider=dict(default=None), image_disk=dict(default=None, aliases=['glance_image_disk_name']), io_threads=dict(type='int', default=None), @@ -534,7 +540,7 @@ def main(): ) elif state == 'imported': template = templates_module.search_entity() - if template: + if template and module.params['clone_name'] is None: ret = templates_module.create( result_state=otypes.TemplateStatus.OK, ) @@ -546,8 +552,9 @@ def main(): name=module.params['template_image_disk_name'] or module.params['image_disk'] ), template=otypes.Template( - name=module.params['name'], + name=module.params['name'] if module.params['clone_name'] is None else module.params['clone_name'], ), + clone=True if module.params['clone_name'] is not None else False, import_as_template=True, )