On Monday, December 3, 2012 5:25:58 PM UTC-6, Dusty Doris wrote:
>
> [...]  I'm trying to figure out how I can re-write this to make it work, 
> but it appears the puppet dsl only acts on arrays when they are the name 
> variable and then calls the resource once for each item in the array, 
> passing that as the name.
>


Yes, that is precisely what Puppet does with arrays given as resource 
titles, and that behavior is triggered *only* by titles.

 

>
> So, I suppose right now I need to make my groups better, so they include 
> all the one-offs and make sure there are no duplicates.  Or, I could just 
> define the one-offs one at a time in each node file.
>
> I appreciate any suggestions.
>
>

One way to look at your issue is that your site-specific data is too 
commingled with your code.  That's why you have one-offs in the first 
place.  Pull the data together into a class variable somewhere, or even 
externalize it into an Hiera data store.  Drive your firewall declarations 
with your data instead of pulling the data along behind.

More specifically, you can use Puppet hashes or Hiera lookups to 
dynamically adapt your declarations to specific cases (e.g. to choose 
parameter values), or you can use the built-in create_resources() function 
to declare whole resources based on your data.  You already know about 
arrays as resource titles and combining that with defined types; those fit 
into the picture, too.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/f_CrWCkUOYEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to