From 428815027053b830ad84bd3570c4d12a8a6bfead Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Sun, 31 Jan 2016 02:51:34 -0800 Subject: [PATCH] Do not install python-apt in check mode. --- lib/ansible/modules/packaging/os/apt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 9b8389ea011..43474f24a61 100755 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -579,6 +579,8 @@ def main(): module.run_command_environ_update = APT_ENV_VARS if not HAS_PYTHON_APT: + if module.check_mode: + module.fail_json(msg="python-apt must be installed to use check mode") try: module.run_command('apt-get update && apt-get install python-apt -y -q --force-yes', use_unsafe_shell=True, check_rc=True) global apt, apt_pkg