schedule whole class and not only resources

51 views
Skip to first unread message

Andreas Dvorak

unread,
Oct 1, 2014, 8:59:33 AM10/1/14
to puppet...@googlegroups.com
Dear all,

I have a class with many resource that should only run at one certain time. I could add a schedule to every resource, but that is the same line at all the resources.
Is there a solution to schedule the whole class at one place.

something like this

include abc {
 schedule ....
}

Best regards,
Andreas

Felix Frank

unread,
Oct 26, 2014, 12:50:33 PM10/26/14
to puppet...@googlegroups.com
Hi,

the intuitive approach would be:

class { 'abc': schedule => ... }

A tentative test seems to indicate that this does in fact not work. If
this is important to you, you could open a feature request in Jira.

Thanks,
Felix

Garrett Honeycutt

unread,
Oct 26, 2014, 9:05:39 PM10/26/14
to puppet...@googlegroups.com
You could use resource defaults[1] to achieve this. If your class is
using the schedule metaparameter for a bunch of exec's you could add

Exec {
schedule => 'my_schedule',
}

schedule { 'my_schedule':
period => daily,
range => '2-4',
}

This would add the schedule parameter with the value 'my_schedule' to
all of the exec{} resources within the class.

[1] - https://docs.puppetlabs.com/puppet/latest/reference/lang_defaults.html

Best regards,
-g


--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658

Andreas Dvorak

unread,
Oct 27, 2014, 4:24:10 AM10/27/14
to puppet...@googlegroups.com
Dear all,

thank you for the responses.
My class has serval different resources types.

If there is no eays solution, it does not matter.

Andreas
Reply all
Reply to author
Forward
0 new messages