diff --git a/lib/ansible/modules/packaging/os/apt_repository.py b/lib/ansible/modules/packaging/os/apt_repository.py index 52208f25987..6cf5014c2fa 100644 --- a/lib/ansible/modules/packaging/os/apt_repository.py +++ b/lib/ansible/modules/packaging/os/apt_repository.py @@ -129,6 +129,8 @@ def install_python_apt(module): HAVE_PYTHON_APT = True else: module.fail_json(msg="Failed to auto-install python-apt. Error was: '%s'" % se.strip()) + else: + module.fail_json(msg="python-apt must be installed to use check mode") class InvalidSource(Exception): pass