# ansible cron with 2.8rc3

**URL:** <https://forum.ansible.com/t/ansible-cron-with-2-8rc3/30308>\
**Category:** Ansible Project\
**Created:** [May 11, 2019, 4:38pm UTC](https://forum.ansible.com/t/ansible-cron-with-2-8rc3/30308 "2019-05-11T16:38:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Stroder](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Michael\_Stroder](https://forum.ansible.com/u/Michael_Stroder)\
**Post date:** [May 11, 2019, 4:38pm UTC](https://forum.ansible.com/t/ansible-cron-with-2-8rc3/30308/1 "2019-05-11T16:38:23Z")

</div>

HI!

I'm testing my ansible roles with ansible 2.8rc3.  
The roles work with ansible 2.7.10.

This cron task fails with 2.8rc3 using Python 2.7.16 (see details  
attached at message end):

- name: "Remove obsolete CRON jobs from /etc/cron.d/aedir\_tools"  
&nbsp;&nbsp;cron:  
&nbsp;&nbsp;&nbsp;&nbsp;name: "{{ item }}"  
&nbsp;&nbsp;&nbsp;&nbsp;state: absent  
&nbsp;&nbsp;&nbsp;&nbsp;cron\_file: aedir\_tools  
&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;- aedirpwd\_cron  
&nbsp;&nbsp;&nbsp;&nbsp;- aedirpwd\_expiry\_check

What's wrong with that?

Ciao, Michael.

-------------------------------- snip --------------------------------  
The full traceback is:  
WARNING: The below traceback may \*not\* be related to the actual failure.  
&nbsp;&nbsp;File  
"/tmp/ansible\_cron\_payload\_HHWGrW/ansible\_cron\_payload.zip/ansible/module\_utils/basic.py",  
line 1529, in \_check\_required\_by  
&nbsp;&nbsp;&nbsp;&nbsp;check\_required\_by(spec, param)  
&nbsp;&nbsp;File  
"/tmp/ansible\_cron\_payload\_HHWGrW/ansible\_cron\_payload.zip/ansible/module\_utils/common/validation.py",  
line 164, in check\_required\_by  
&nbsp;&nbsp;&nbsp;&nbsp;raise TypeError(to\_native(msg))

failed: [ae-dir-suse-p1.virtnet1.stroeder.local] (item=aedirpwd\_cron) =\>  
{  
&nbsp;&nbsp;&nbsp;&nbsp;"ansible\_loop\_var": "item",  
&nbsp;&nbsp;&nbsp;&nbsp;"changed": false,  
&nbsp;&nbsp;&nbsp;&nbsp;"invocation": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"module\_args": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"backup": false,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"cron\_file": "aedir\_tools",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"day": "\*",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"disabled": false,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"hour": "\*",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"minute": "\*",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"month": "\*",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"name": "aedirpwd\_cron",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"reboot": false,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"state": "absent",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"weekday": "\*"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;},  
&nbsp;&nbsp;&nbsp;&nbsp;"item": "aedirpwd\_cron",  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "missing parameter(s) required by 'cron\_file': user"  
}

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 11, 2019, 5:15pm UTC](https://forum.ansible.com/t/ansible-cron-with-2-8rc3/30308/2 "2019-05-11T17:15:27Z")

</div>

> I'm testing my ansible roles with ansible 2.8rc3.  
> The roles work with ansible 2.7.10.
> 
> This cron task fails with 2.8rc3 using Python 2.7.16 (see details  
> attached at message end):
> 
> - name: "Remove obsolete CRON jobs from /etc/cron.d/aedir\_tools"  
> &nbsp;&nbsp;&nbsp;cron:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: "{{ item }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: absent  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cron\_file: aedir\_tools  
> &nbsp;&nbsp;&nbsp;with\_items:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- aedirpwd\_cron  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- aedirpwd\_expiry\_check
> 
> What's wrong with that?

\<snip /\>

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"msg": "missing parameter(s) required by 'cron\_file': user"  
> }

As the message say you are missing the user parameter, per documentation this is required.

That said, the user parameter is irrelevant when state is absent so I would call this a bug.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 11, 2019, 5:37pm UTC](https://forum.ansible.com/t/ansible-cron-with-2-8rc3/30308/3 "2019-05-11T17:37:21Z")

</div>

Here is the culprit PR  
[https://github.com/ansible/ansible/pull/28662](https://github.com/ansible/ansible/pull/28662)

---

<div class="post-metadata">

**Author:** ![Michael\_Stroder](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Michael\_Stroder](https://forum.ansible.com/u/Michael_Stroder)\
**Post date:** [May 13, 2019, 11:53am UTC](https://forum.ansible.com/t/ansible-cron-with-2-8rc3/30308/4 "2019-05-13T11:53:02Z")

</div>

Hmm, should I file a bug?

Ciao, Michael.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 13, 2019, 1:51pm UTC](https://forum.ansible.com/t/ansible-cron-with-2-8rc3/30308/5 "2019-05-13T13:51:19Z")

</div>

yes, please do
