# Unexpected Behavior from Cron Module

**URL:** <https://forum.ansible.com/t/unexpected-behavior-from-cron-module/13822>\
**Category:** Ansible Project\
**Created:** [November 1, 2013, 4:04am UTC](https://forum.ansible.com/t/unexpected-behavior-from-cron-module/13822 "2013-11-01T04:04:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Casey\_Huggins](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@Casey\_Huggins](https://forum.ansible.com/u/Casey_Huggins)\
**Post date:** [November 1, 2013, 4:04am UTC](https://forum.ansible.com/t/unexpected-behavior-from-cron-module/13822/1 "2013-11-01T04:04:59Z")

</div>

I noticed that the following task always results in a ‘changed’ message from my plays:

- name: remove cron  
cron: cron\_file=mycronfile state=absent

This appears to be due to this line in the cron module:

[https://github.com/ansible/ansible/blob/devel/library/system/cron#L468](https://github.com/ansible/ansible/blob/devel/library/system/cron#L468)

This seems odd to me–why not only report changed if a file was actually unlinked? If this is intentional, could someone explain the reason? Just want to understand why the modules are written the way they are.

---

<div class="post-metadata">

**Author:** ![Patrick\_Callahan](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@Patrick\_Callahan](https://forum.ansible.com/u/Patrick_Callahan)\
**Post date:** [November 2, 2013, 2:15am UTC](https://forum.ansible.com/t/unexpected-behavior-from-cron-module/13822/2 "2013-11-02T02:15:13Z")

</div>

I just took at look at this-I rewrote the cron module back in July-and it does look like a bug. I agree that when removing a cron\_file the module should only report changed if the file was unlinked.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 2, 2013, 3:06am UTC](https://forum.ansible.com/t/unexpected-behavior-from-cron-module/13822/3 "2013-11-02T03:06:37Z")

</div>

Bugs should be filed on github at [github.com/ansible/ansible](http://github.com/ansible/ansible) – please go ahead and file one.

Should be an easy fix 🙂

---

<div class="post-metadata">

**Author:** ![Casey\_Huggins](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@Casey\_Huggins](https://forum.ansible.com/u/Casey_Huggins)\
**Post date:** [November 3, 2013, 7:46pm UTC](https://forum.ansible.com/t/unexpected-behavior-from-cron-module/13822/4 "2013-11-03T19:46:10Z")

</div>

Done: [https://github.com/ansible/ansible/issues/4795](https://github.com/ansible/ansible/issues/4795)
