diff --git a/changelogs/fragments/57464-set-ovirt-disk-active-default.yaml b/changelogs/fragments/57464-set-ovirt-disk-active-default.yaml new file mode 100644 index 00000000000..b5d538b2ff2 --- /dev/null +++ b/changelogs/fragments/57464-set-ovirt-disk-active-default.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Fix the issue that disk is not activated after its creation (https://github.com/ansible/ansible/issues/57412) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_disk.py b/lib/ansible/modules/cloud/ovirt/ovirt_disk.py index 2a52ccb3e44..4ffac7d2aa5 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_disk.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_disk.py @@ -190,6 +190,7 @@ options: activate: description: - I(True) if the disk should be activated. + - When creating disk of virtual machine it is set to I(True). version_added: "2.8" type: bool extends_documentation_fragment: ovirt @@ -709,6 +710,9 @@ def main(): ret = None # First take care of creating the VM, if needed: if state in ('present', 'detached', 'attached'): + # Always activate disk when its being created + if vm_service is not None and disk is None: + module.params['activate'] = True ret = disks_module.create( entity=disk if not force_create else None, result_state=otypes.DiskStatus.OK if lun is None else None,