I have several processes running on servers with different roles that are monitored by monit. For example, say I have an Apache server and a DB server with MySQL. I have several monitrc files that can be dropped in to monit's configuration directory to monitor these processes. What's the most elegant way in chef to make sure the appropriate files get into the monit configuration directory, based on the role?
Options I see: 1) use a template resource in a monit cookbook that checks the node's roles to see if it should be executing
2) use a template resource in the apache and mysql cookbooks (but check to see if monit is installed somehow)
3) Create separate recipies in the monit cookbook for each role, and add them to the run list for the role (monit::mysql, monit::apache, etc.)
What I'd really like to do is put the code for ensuring the files are moved in the role's file, but I don't think that's possible. Ideas?