ansible/ansible — pull request #2019 by rhaido (2013-02-08 08:39:17+00:00)
Title: New feature for 'cron' module: cron_file attribute

- added cron_file attribute: if specified, the file with appropriate job is created in /etc/cron.d directory. Also, you can store multiple jobs in one file. If the cron_file is not specified, the module behaves like always.
- state='absent' attribute is handled appropriately in the following way in this case: if after the deletion of the job from the file specified by cron_file variable the file is empty, the file is deleted, otherwise not.
- fixed the behaviour, when the backupfile is saved forever in /tmp folder, even if the backup= atribute is not set (os.unlink() is called if backup is not True).
- added some comments to the unobvious places
- added cron_test.yml to tests folder to test the cron module (with new features)

Please note, that for putting file in /etc/cron.d folder you need a super-user privileges.

The main motivation for this feature is the fact, that you can easily 'grep' the /etc/cron.d repo, and the place is much more obvious to search in, than personalized /var/spool/ crontabs. Also, interference in the user's crontab could be considered as a abusive and criminal action, and it's a bit better and cleaner to do with /etc/cron.d/* files.

Thank you for you attention and have a good day!