How to list all resources of a certain type?

asked 2017-01-20 01:33:19 -0600

UnitedMarsupials gravatar image

Can a Puppet-manifest (or an ERB-template) enumerate through all defined resources of a particular type?

For example, I want to list all of the Puppet-managed users -- can I list all of the User-resources as a hash and go through it?

For another example, I'd like to go through all of the tomcat-instances on a machine -- such as to set up log-rotation for all of the catalina.outs...

We use Puppet-3.8 and a recent version of Puppet stdlib...

(I found some references to findresource-function, but trying to call it from inside a template fails.)

edit retag flag offensive close merge delete

Comments

As general answer to loading it in the template, you can always create your hash/structure in your puppet code, and access it in your templates.

DarylW gravatar imageDarylW ( 2017-01-20 07:42:41 -0600 )edit

@DaryIW, thanks, I know. This is why I asked for "Puppet-manifest _or_ ERB-template". But for now, I don't know, how to do it in either... Do you?

UnitedMarsupials gravatar imageUnitedMarsupials ( 2017-01-20 12:12:56 -0600 )edit

Oh, sorry, I misread what you said, and I thought that you said you found references to findresource, but couldn't get THAT working inside your template, not that you couldn't get it working in general!

DarylW gravatar imageDarylW ( 2017-01-23 07:24:17 -0600 )edit