Created
November 1, 2013 17:56
-
-
Save tgerla/7269228 to your computer and use it in GitHub Desktop.
Test to see if selinux is enabled.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
tasks: | |
# this task runs 'getenforce' and registers the result into the "sestatus" variable | |
# changed_when: false tells ansible never to mark this task as "changed" | |
- name: test to see if selinux is running | |
command: getenforce | |
register: sestatus | |
changed_when: false | |
# this task tests to see if the output | |
- name: print a message if selinux is enabled | |
debug: msg="selinux is enabled" | |
when: '"Enabled" in sestatus.stdout' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On my home machine, getenforce output is "Enforcing"
[ray@f19 ~]$ getenforce
Enforcing
[ray@f19 ~]$ echo $?
0