mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ovirt_templates: added option to name imported disk as a template (#27902)
* ovirt_templates: added option to name imported disk as a template * ovirt_templates: added version_added to new attribute * ovirt_templates: added alias for image_name and example * added alias glance_image_disk_name for image_name * example how to import image from glance as template * improve description of template_image_disk_name
This commit is contained in:
parent
f7321a87ca
commit
a48a7eecc8
1 changed files with 20 additions and 2 deletions
|
@ -72,6 +72,13 @@ options:
|
||||||
description:
|
description:
|
||||||
- "When C(state) is I(imported) and C(image_provider) is used this parameter specifies the name of disk
|
- "When C(state) is I(imported) and C(image_provider) is used this parameter specifies the name of disk
|
||||||
to be imported as template."
|
to be imported as template."
|
||||||
|
aliases: ['glance_image_disk_name']
|
||||||
|
template_image_disk_name:
|
||||||
|
description:
|
||||||
|
- "When C(state) is I(imported) and C(image_provider) is used this parameter specifies the new name for imported disk,
|
||||||
|
if omitted then I(image_disk) name is used by default.
|
||||||
|
This parameter is used only in case of importing disk image from Glance domain."
|
||||||
|
version_added: "2.4"
|
||||||
storage_domain:
|
storage_domain:
|
||||||
description:
|
description:
|
||||||
- "When C(state) is I(imported) this parameter specifies the name of the destination data storage domain.
|
- "When C(state) is I(imported) this parameter specifies the name of the destination data storage domain.
|
||||||
|
@ -116,6 +123,16 @@ EXAMPLES = '''
|
||||||
name: mytemplate
|
name: mytemplate
|
||||||
storage_domain: mystorage
|
storage_domain: mystorage
|
||||||
cluster: mycluster
|
cluster: mycluster
|
||||||
|
|
||||||
|
# Import image from Glance s a template
|
||||||
|
- ovirt_templates:
|
||||||
|
state: imported
|
||||||
|
name: mytemplate
|
||||||
|
image_disk: "centos7"
|
||||||
|
template_image_disk_name: centos7_from_glance
|
||||||
|
image_provider: "glance_domain"
|
||||||
|
storage_domain: mystorage
|
||||||
|
cluster: mycluster
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
@ -228,7 +245,8 @@ def main():
|
||||||
storage_domain=dict(default=None),
|
storage_domain=dict(default=None),
|
||||||
exclusive=dict(type='bool'),
|
exclusive=dict(type='bool'),
|
||||||
image_provider=dict(default=None),
|
image_provider=dict(default=None),
|
||||||
image_disk=dict(default=None),
|
image_disk=dict(default=None, aliases=['glance_image_disk_name']),
|
||||||
|
template_image_disk_name=dict(default=None),
|
||||||
)
|
)
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
@ -279,7 +297,7 @@ def main():
|
||||||
if module.params['image_provider']:
|
if module.params['image_provider']:
|
||||||
kwargs.update(
|
kwargs.update(
|
||||||
disk=otypes.Disk(
|
disk=otypes.Disk(
|
||||||
name=module.params['image_disk']
|
name=module.params['template_image_disk_name'] or module.params['image_disk']
|
||||||
),
|
),
|
||||||
template=otypes.Template(
|
template=otypes.Template(
|
||||||
name=module.params['name'],
|
name=module.params['name'],
|
||||||
|
|
Loading…
Reference in a new issue