Running multiple recipes/roles

Hello,

I need to run multiple roles on a node at different frequencies. e.g. rolea needs to run daily but roleb needs run every 30 minutes.

How can I set that up using chef-client cookbook? Each role has interval attribute set, however, node has only chef-client attribute, and hence it appears that I can only set one role at one interval.

Is there any other way achieving this?

thanks in advance

M

The interval is a property of the configuration of a given node - it’s not something applied by roles. How often a node converges is done irrespective of what roles it has or attributes set (aside from chef-client cookbok of course). It would be difficult to model Chef in the way it seems you want to use it - which would be switching your run_list depending on the schedule.

The chef-client cookbook doesn’t support this because chef itself doesn’t really support that model of execution. While you might change the run_list over the life of the node, running one run_list every hour and another run_list every 30 minutes is an easy way to break configuration and step on your own toes. This is almost akin to running a chef-client on a machine with two different config at different intervals, it might be doable but it’s not exactly recommended and a quick path to frustration.