Via Ansible, is there any way to remove a CRON job entry that was not created by Ansible? For example, I have the entry below, but as you can see, it does not have the ansible above it, so it does not have a “name” parameter to remove.
> Via Ansible, is there any way to remove a CRON job entry that was not
> created by Ansible? For example, I have the entry below, but as you can
> see, it does not have the ansible above it, so it does not have a "name"
> parameter to remove.
>
> 4 3 * * * /sbin/shutdown -r now >/dev/null 2>&1
Put the entries into a dictionary and test it in scratch first
These two tasks are idempotent. You'll have to run such playbook
twice, at least for the first time to add missing descriptions to
enabled items. Then you can keep the *lineinfile* task in the playbook
to make sure the descriptions are present.