Zac B
Zac B

Reputation: 4232

Puppet Syntax: How to make a collection that only applies to resources in a given class?

In Puppet, say I have a class which contains numerous file and package resources. I want to use resource chaining ( -> and ~> ) to ensure that they get managed in the proper order. I want all file resources to be managed before package resources. I read the Puppet Language Guide section on resource chaining, and tried its suggestion, using collections, like so:

File <| |> -> Package["package1"] -> Package["package2"] and so on.

However, that didn't work, and some really weird behavior occurred: that instruction managed every single file object in my Puppet configuration, not just in the class I was working on, before the packages specified.

How would I use collections to say "manage every file object in this class only before the specified resources?

Upvotes: 0

Views: 596

Answers (1)

Mark Roggenkamp
Mark Roggenkamp

Reputation: 144

Probably not what you're looking for but you could separate your File resources into a separate manifest mymodule::myfiles and then in do Class['Mymodule::Myfiles'] -> Package['package1'] and so on.

Upvotes: 1

Related Questions