On Tuesday, July 16, 2013 10:13:58 AM UTC-5, Mark Hatch wrote:
>
> I started making manifest that are classes so that I can declare them and 
> organize them with groups and nodes in puppet console.  I have one 
> manifest/class that I want to run before anything.  I know that there are 
> ways to order with require, before, subscribe, etc.  But it seems that if I 
> did before, I would have to list all of the other classes that it should 
> come before.  And if I add more classes, I would have to include those as 
> well.
>
> Same thing with "subscribe".  I would have to add subscribe to every class 
> that I want to happen after this first one.  I could order with one 
> manifest/class, but then I can't organize things as granular in the puppet 
> console.
>
> Any way to accomplish what I am trying to do?  Is it clear what I'm trying 
> to do?
>
>

As Martin said, run stages can do what you describe.  You put the class you 
want to run first in its own stage that is applied before stage 'main'.  
Take care, however: you can cause yourself at least as much trouble with 
stages as you hope to resolve.

Although stages are probably the best solution to the problem as you have 
framed it, the requirement that a given class be applied before any other 
is probably a bit artificial.  You can usually avoid such requirements by 
using smarter classes and resources, and / or by using the chain operators 
to declare relationships separately from the classes and resources to be 
related.  Collections and tags can really grease the wheels on this.

For example, for Yum-based systems you might want to ensure that all 
Yumrepo resources are applied before any Package resources.  You can 
express that in Puppet DSL like so:

Yumrepo<| |> -> Package<| |>

Put that in any class and assign that class to the target node, and you get 
all the needed relationships between Yumrepos and Packages.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to