Ansible name parameters in cron

Software

Speaking of Ansible, I was late to adding cron jobs the right way instead of using lineinfile. And immediately got this:

[DEPRECATION WARNING]: The ’name’ parameter will be required in future releases.. This feature will be removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

I wasn’t sure what name should be… did it need to be the name of the script or binary being executed? From the docs:

When crontab jobs are managed: the module includes one line with the description of the crontab entry “#Ansible: <name>” corresponding to the “name” passed to the module, which is used by future ansible/module calls to find/check the state. The “name” parameter should be unique, and changing the “name” value will result in a new cron task being created (or a different one being removed).

Okay, that makes sense. Done.

cron:
  user: root
  name: "Earworm"
  job: "bennie-bennie-bennie-bennie-bennie-and-the-jets.pl"
  special_time: monthly

Author bio and support

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!