it seems the command "setenforce 0" exit with non-zero exit code when it is already disabled. So it probably just need need to say ansible that "if you see the message 'setenforce: SELinux is disabled'" in stderr, that is not failure". You may do it with "failed_when" keyword in ansible. May be something like this. - name: Disable selinux for redhat systems command: setenforce 0 register: disable_selinux failed_when: (disable_selinux.rc != 0 and disable_selinux.stderr not in "setenforce: SELinux is disabled" ) when: ansible_os_family == 'RedHat' BTW, You may have to test this. On Fri, May 12, 2017 at 7:37 AM, Rudra Rugge