Skip to content

Commit

Permalink
Add a fact about apparmor, to see if that's loaded or not
Browse files Browse the repository at this point in the history
  • Loading branch information
mscherer authored and bcoca committed Jan 9, 2017
1 parent 5bbab91 commit 0847a13
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ansible/module_utils/facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def __init__(self, module, load_on_init=True, cached_facts=None):
self.get_cmdline()
self.get_public_ssh_host_keys()
self.get_selinux_facts()
self.get_apparmor_facts()
self.get_caps_facts()
self.get_fips_facts()
self.get_pkg_mgr_facts()
Expand Down Expand Up @@ -468,6 +469,13 @@ def get_selinux_facts(self):
except (AttributeError,OSError):
self.facts['selinux']['type'] = 'unknown'

def get_apparmor_facts(self):
self.facts['apparmor'] = {}
if os.path.exists('/sys/kernel/security/apparmor'):
self.facts['apparmor']['status'] = 'enabled'
else:
self.facts['apparmor']['status'] = 'disabled'

def get_caps_facts(self):
capsh_path = self.module.get_bin_path('capsh')
if capsh_path:
Expand Down

0 comments on commit 0847a13

Please sign in to comment.