# Why do these SELinux tasks report "changed" every time?

**URL:** <https://forum.ansible.com/t/why-do-these-selinux-tasks-report-changed-every-time/18721>\
**Category:** Ansible Project\
**Created:** [July 9, 2015, 9:57pm UTC](https://forum.ansible.com/t/why-do-these-selinux-tasks-report-changed-every-time/18721 "2015-07-09T21:57:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will\_Dennis](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Will\_Dennis](https://forum.ansible.com/u/Will_Dennis)\
**Post date:** [July 9, 2015, 9:57pm UTC](https://forum.ansible.com/t/why-do-these-selinux-tasks-report-changed-every-time/18721/1 "2015-07-09T21:57:25Z")

</div>

Hi all,

I have two tasks in a playbook as follows:

- name: RHELFAM | Set SELinux to permissive  
selinux: policy=targeted state=permissive  
tags: secmods

- name: RHELFAM | Disable SELinux in conf file  
selinux: state=disabled  
tags: secmods

Each time they run, even if the target machine is in the desired state, the task returns “changed”… Why would that be?

Thanks,

Will

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 11, 2015, 1:25am UTC](https://forum.ansible.com/t/why-do-these-selinux-tasks-report-changed-every-time/18721/2 "2015-07-11T01:25:20Z")

</div>

well, i would expect one if not both to always return changed, I  
looked at the module code and it does compare against existing state  
to determine change status

---

<div class="post-metadata">

**Author:** ![Will\_Dennis](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Will\_Dennis](https://forum.ansible.com/u/Will_Dennis)\
**Post date:** [July 11, 2015, 3:31am UTC](https://forum.ansible.com/t/why-do-these-selinux-tasks-report-changed-every-time/18721/3 "2015-07-11T03:31:40Z")

</div>

Ah, I see what you mean… the first one has state=permissive, and the next state=disabled… So they were just bouncing back and forth… D’oh!

I guess that’s why folks suggest code review as a best practice 😉

Thanks!  
Will
