mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
os_image: Add checksum based glance image manipulation (#27107)
* Add checksum based glance image manipulation * Update os_image.py * Move to 2.5
This commit is contained in:
parent
ae29245e05
commit
96ebfd78af
1 changed files with 11 additions and 1 deletions
|
@ -44,6 +44,12 @@ options:
|
||||||
- The Id of the image
|
- The Id of the image
|
||||||
required: false
|
required: false
|
||||||
default: None
|
default: None
|
||||||
|
checksum:
|
||||||
|
version_added: "2.5"
|
||||||
|
description:
|
||||||
|
- The checksum of the image
|
||||||
|
required: false
|
||||||
|
default: None
|
||||||
disk_format:
|
disk_format:
|
||||||
description:
|
description:
|
||||||
- The format of the disk that is getting uploaded
|
- The format of the disk that is getting uploaded
|
||||||
|
@ -138,6 +144,7 @@ def main():
|
||||||
argument_spec = openstack_full_argument_spec(
|
argument_spec = openstack_full_argument_spec(
|
||||||
name = dict(required=True),
|
name = dict(required=True),
|
||||||
id = dict(default=None),
|
id = dict(default=None),
|
||||||
|
checksum = dict(default=None),
|
||||||
disk_format = dict(default='qcow2', choices=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2', 'vdi', 'iso', 'vhdx', 'ploop']),
|
disk_format = dict(default='qcow2', choices=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2', 'vdi', 'iso', 'vhdx', 'ploop']),
|
||||||
container_format = dict(default='bare', choices=['ami', 'aki', 'ari', 'bare', 'ovf', 'ova', 'docker']),
|
container_format = dict(default='bare', choices=['ami', 'aki', 'ari', 'bare', 'ovf', 'ova', 'docker']),
|
||||||
owner = dict(default=None),
|
owner = dict(default=None),
|
||||||
|
@ -160,6 +167,9 @@ def main():
|
||||||
cloud = shade.openstack_cloud(**module.params)
|
cloud = shade.openstack_cloud(**module.params)
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
if module.params['checksum']:
|
||||||
|
image = cloud.get_image(name_or_id=None,filters={'checksum': module.params['checksum']})
|
||||||
|
else:
|
||||||
image = cloud.get_image(name_or_id=module.params['name'])
|
image = cloud.get_image(name_or_id=module.params['name'])
|
||||||
|
|
||||||
if module.params['state'] == 'present':
|
if module.params['state'] == 'present':
|
||||||
|
|
Loading…
Reference in a new issue