diff --git a/lib/ansible/module_common.py b/lib/ansible/module_common.py index d61e2aa8d2d..df91d753507 100644 --- a/lib/ansible/module_common.py +++ b/lib/ansible/module_common.py @@ -265,6 +265,11 @@ class AnsibleModule(object): def selinux_enabled(self): if not HAVE_SELINUX: + seenabled = get_bin_path('selinuxenabled') + if seenabled is not None: + (rc,out,err) = run_command(seenabled) + if rc == 0: + self.fail_json(msg="Aborting, target uses selinux but python bindings (python-selinux) aren't installed!") return False if selinux.is_selinux_enabled() == 1: return True