I'm trying to execute a scheduled task on a large-ish pool of virtual servers, but I want to minimize the resulting performance impact on the hypervisor, ideally executing it on one server at a time.
Think something like this:
Hr07.Min01.host_1::
"scheduled_service_restart" usebundle => service_restart;
Hr07.Min02.host_2::
"scheduled_service_restart" usebundle => service_restart;
Hr07.Min03.host_3::
"scheduled_service_restart" usebundle => service_restart;
...
Now, this works; but the list will grow significantly, and isn't exactly pretty to look at.
Can I match the hostname sequence number (or sequence number of any general class) against the integer in the MinXY
hardclass somehow?
I would not recommend using the 1 minute resolution classes like Min01 unless you are running the agent on a 1 minute interval. That class will only be defined during that one minute. By default the agent runs every 5 minutes, and even with large policy sets a complete policy run usually completes within a minute.
You might want to take a look at the splayclass function. You can define a class deterministically over an hourly or daily period. For example:
#cfengine on irc.freenode.net and the help-cfengine are also great places to ask CFEngine related questions.