title: Remove cron using Ansible
body: <p>I am trying to remove cron job from all nodes. Ansible script runs without any error but it doesn't remove the cron.</p>
  
  <p>Here is my playbook</p>
  
  <pre><code>---
  - hosts: all
    user: &lt;user_name&gt;
    tasks:
    - name: disable cron
      cron:
        name: clean
        env: yes
        state: absent
        user: root
      become: True
  </code></pre>
  
  <p>Here is my cron on destination host.</p>
  
  <pre><code>[root@host1]# crontab -l
  
  #Ansible: None
  */5 * * * * /root/cleanup.sh
  
  #Ansible: None
  */5 * * * * /root/cleanup.sh
  
  #Ansible: clean
  */5 * * * * /root/cleanup.sh
  </code></pre>
  
  <p>I tried replacing name with <code>None</code>, <code>Ansible: None</code>, <code>#Ansible: None</code> and <code>clean</code>. None of them worked. </p>
  
  <p>How can I remove this cron? Look like idempotency not working for cron module in ansible, because I ran put cron twice and it place cronjob twice. </p>