diff --git a/changelogs/fragments/1402-vmware_guest_change_to_fail_json.yml b/changelogs/fragments/1402-vmware_guest_change_to_fail_json.yml new file mode 100644 index 000000000..8fd490b43 --- /dev/null +++ b/changelogs/fragments/1402-vmware_guest_change_to_fail_json.yml @@ -0,0 +1,2 @@ +bugfixes: + - vmware_guest - Fix no fail attribute issue (https://github.com/ansible-collections/community.vmware/issues/1401). diff --git a/plugins/modules/vmware_guest.py b/plugins/modules/vmware_guest.py index 37cdb868e..44094fcb9 100644 --- a/plugins/modules/vmware_guest.py +++ b/plugins/modules/vmware_guest.py @@ -3373,13 +3373,13 @@ def main(): # Check requirements for virtualization based security if pyv.params['hardware']['virt_based_security']: if not pyv.params['hardware']['nested_virt']: - pyv.module.fail("Virtualization based security requires nested virtualization. Please enable nested_virt.") + pyv.module.fail_json(msg="Virtualization based security requires nested virtualization. Please enable nested_virt.") if not pyv.params['hardware']['secure_boot']: - pyv.module.fail("Virtualization based security requires (U)EFI secure boot. Please enable secure_boot.") + pyv.module.fail_json(msg="Virtualization based security requires (U)EFI secure boot. Please enable secure_boot.") if not pyv.params['hardware']['iommu']: - pyv.module.fail("Virtualization based security requires I/O MMU. Please enable iommu.") + pyv.module.fail_json(msg="Virtualization based security requires I/O MMU. Please enable iommu.") # Check if the VM exists before continuing vm = pyv.get_vm()