Ansible name parameters in cron


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.

  user: root
  name: "Earworm"
  job: ""
  special_time: monthly

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

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

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.