diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vms.py b/lib/ansible/modules/cloud/ovirt/ovirt_vms.py index dd733eb3234..d21e336c8b6 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_vms.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_vms.py @@ -607,7 +607,7 @@ class VmsModule(BaseModule): self.param('template_version') ) ) - template = templates[0] + template = sorted(templates, key=lambda t: t.version.version_number, reverse=True)[0] return template