Scheduling when resources are applied
So far, we looked at what Puppet can do, and the order that it does things in, but not when it does them. One way to control this is to use the schedule
metaparameter. When you need to limit the number of times a resource is applied within a specified period, schedule
can help. For example:
exec { "/usr/bin/apt-get update": schedule => daily, }
The most important thing to understand about schedule
is that it can only stop a resource being applied. It doesn't guarantee that the resource will be applied with a certain frequency. For example, the exec
resource shown in the preceding code snippet has schedule => daily
, but this just represents an upper limit on the number of times the exec
resource can run per day. It won't be applied more than once a day. If you don't run Puppet at all, the resource won't be applied at all. Using the hourly schedule, for instance, is meaningless on a machine configured to run the agent every 4 hours (via the runinterval...