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

172 views
Skip to first unread message

Willard Dennis

unread,
Jul 9, 2015, 5:57:25 PM7/9/15
to ansible...@googlegroups.com
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

Brian Coca

unread,
Jul 10, 2015, 9:25:27 PM7/10/15
to ansible...@googlegroups.com
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


--
Brian Coca

Willard Dennis

unread,
Jul 10, 2015, 11:31:40 PM7/10/15
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages