Ansible name parameters in cron
SoftwareSpeaking 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