Dear List,

I've been using Puppet for over a year now and I'm quite enjoying it. I've
learned some stuff but there is of course always room for improvement. Now
I have a task which needs a nicer solution than I'm currently capable of.

I have a hash of items with to key/value pairs, which is *the same for
every node*:

$input_base => {
  input1 => { 'port' => '2001', 'component' => 'component1' },
  input2 => { 'port' => '2002', 'component' => 'component2' }
}

Then I have a second hash, which is different for every node.

$input_node => {
  input3 => { 'port' => '2003', 'component' => 'component3' },
  [possibly input4... inputN]
}

These all will be used in a single template. So I can simply do:

$input_merged = merge($input_base, $input_node)

The corresponding port/component entries will then be added in a
configuration file with an $input_merged.each_pair - so far so good.



Now the actual task: I need an extra configfile, generated from a template,
for all the inputN elements of the $input_node - but only for them, not for
the $input_base elements - like this:

* /path/to/project_input3.conf
* [/path/to/project_input4.conf...project_inputN.conf]

This would be possible with create_resources:

create_resources(file, $input_merged)

but in order to do this, $input_merged should have the values of a file
resource - at least "path" and "source => template()". This is not the case.

I could define $input_node initially as a file resource hash - but in this
case I can't merge it anymore with $input_base.

Currently I have no other idea than manually map the input_node elements
into a third hash, and use that with create_resources, but there should be
a nicer solution. Do you have an idea? :-)


Best,
Rp

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CANwwCtzSGFSUaJsraux2sAifauq%3D9%2BHuZT-kt6jpUBJWnvVZ%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to