diff --git a/lib/ansible/modules/extras/packaging/os/dnf.py b/lib/ansible/modules/extras/packaging/os/dnf.py index 24fa58b60bb..cac32c7b4e0 100644 --- a/lib/ansible/modules/extras/packaging/os/dnf.py +++ b/lib/ansible/modules/extras/packaging/os/dnf.py @@ -237,7 +237,7 @@ def _mark_package_install(module, base, pkg_spec): try: base.install(pkg_spec) except exceptions.MarkingError: - module.fail(msg="No package {} available.".format(pkg_spec)) + module.fail_json(msg="No package {} available.".format(pkg_spec)) def ensure(module, base, state, names):