A collection of task oriented solutions in Puppet

 

Managing entries under /etc/cron.d

Challenge

You want to manage one or more entries in a file located under "/etc/cron.*"

Solution

Manage the entire crontab file. As a single file, a concat, a define or via Augeas.

Explanation

The built in Puppet type only manages per user crontab files (the kind that exist under /var/spool/cron on Linux). There is currently no built in way to explicitly manage cron file entries under /etc, although you can use many of the other types as a work around.

The easiest way to do this is with a file resource, with either static text or via a template, that simply contains the whole contents of the cron entry. This doesn't provide any specific validation or abstraction but it is very easy to do.