On Monday, May 2, 2016 at 11:29:51 AM UTC-5, Manoj Muraleedharan wrote:
>
> I have two erb template, one for main config file and another for child 
> process config file. I need to want to create config file for 3 child 
> process config file inside main erb template by calling another erb 
> template inside. these 3 config files has to be three different name.
>
> I need the following config file create in my puppet agent
> /etc/app/main.conf
> /etc/app/child1.conf
> /etc/app/child2.conf
> /etc/app/child3.conf
>
> I have two erb file in my modeule main.erb and child.erb
>
> I want to call only the main.erb and when processing main.erb i need to 
> create the above child.conf file based on child.erb
>


As Peter observed, Puppet templates are evaluated on the master.  Even if a 
template created additional outputs as a side effect of its evaluation, you 
would need to declare a File resource corresponding to each one for that to 
be in any way usable, and at that point I don't see what's to be gained by 
driving the whole thing from one master template.

Even if you were using 'puppet apply', so that in principle, Ruby scriptlet 
code in the template could indeed drop files in arbitrary places on the 
target file system, you probably still would not want to do that.  There is 
a variety of reasons why you want to be sure that Puppet knows what 
resources it is actually managing.

My best guess as to why you think you want to do this is that you are 
performing some kind of computation in the main ERB whose results you want 
to (re)use to build the child configs.  If that's the case, then you are 
doing too much work in your template.  Factor out any such code into the 
host Puppet manifest or into a custom function.


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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4cc090ab-53f3-43de-8b3c-39c54e67b39f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to