# Task reported as "changed" even if unchanged

**URL:** <https://forum.ansible.com/t/task-reported-as-changed-even-if-unchanged/32949>\
**Category:** Ansible Project\
**Created:** [May 16, 2020, 10:20am UTC](https://forum.ansible.com/t/task-reported-as-changed-even-if-unchanged/32949 "2020-05-16T10:20:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc\_Haber](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Marc\_Haber](https://forum.ansible.com/u/Marc_Haber)\
**Post date:** [May 16, 2020, 10:20am UTC](https://forum.ansible.com/t/task-reported-as-changed-even-if-unchanged/32949/1 "2020-05-16T10:20:20Z")

</div>

Hi,

the following task:

- name: configure systemd-timesyncd - check unit active  
&nbsp;&nbsp;command:  
&nbsp;&nbsp;&nbsp;&nbsp;argv:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "systemctl"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "is-enabled"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "systemd-timesyncd"  
&nbsp;&nbsp;check\_mode: no  
&nbsp;&nbsp;register: systemd\_timesyncd\_unit\_enabled

yields a "changed" in the playbook output:

TASK [systemd-timesyncd : configure systemd-timesyncd - check unit active] \*\*\*\*\*  
changed: [news1]  
changed: [check]  
changed: [slide]

Can I have ansible ignore that and output an "ok" instead for cosmetic reasons  
and for statistics?

Greetings  
Marc

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 16, 2020, 10:24am UTC](https://forum.ansible.com/t/task-reported-as-changed-even-if-unchanged/32949/2 "2020-05-16T10:24:08Z")

</div>

You can use the changed\_when task directive to control when a change is reported. If you want to say this will never create a change set ‘changed\_when: false’

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [May 16, 2020, 10:25am UTC](https://forum.ansible.com/t/task-reported-as-changed-even-if-unchanged/32949/3 "2020-05-16T10:25:50Z")

</div>

Hi,

you should better use systemd module instead of command to do what you intended to do... This module is better at idempotence that command

Command is not idempotent by default, you have to do it (there are different ways to do it), this is why you have some changes

Regards,

---

<div class="post-metadata">

**Author:** ![Marc\_Haber](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Marc\_Haber](https://forum.ansible.com/u/Marc_Haber)\
**Post date:** [May 16, 2020, 10:42am UTC](https://forum.ansible.com/t/task-reported-as-changed-even-if-unchanged/32949/4 "2020-05-16T10:42:01Z")

</div>

Thanks for answering my question, that was helpful!

Greetings  
Marc
